
Technology
Make React reactive
From static to dynamic: Making React ready for reactive streams.
Introduction
Not long ago, I had a lively debate with a colleague about which frontend technology we should use for migrating an existing project. Currently, the frontend is built with Angular, while the backend consists of several Java-based microservices but that’s not really relevant here.
The core issue: the new frontend needs to display real-time data streams via MQTT.
My colleague made a point that, for him, was absolutely decisive:
“React is not reactive.”
Not the only reason for his preference, but that sentence stuck with me and became the spark for this article.
Yes, React is not reactive.
But what does that even mean?
Reactive programming is a declarative paradigm centered around data streams. A system reacts to events instead of polling for changes explicitly.
In other words: the application wants to be informed when the state changes without having to constantly ask, like sending periodic GET requests to a REST API.
REST wasn’t built for that. That’s what message brokers like MQTT, Kafka, or WebSockets are for. (Okay, I’m already going off on a tangent…)
What triggered me about my colleague’s statement was the implication that React can’t handle data streams properly.
My response?
“Challenge accepted. I will try, so hold my beer.”
Continue reading: Click here
