Can I use RxJS vs Redux/context when trying to manage and access state in different components and handler methods [closed]

In short, they are very different libraries for very different purposes, but yes there are some vague similarities.

Redux is a tool for managing state throughout the application. It is usually used as an architecture for UIs. Think of it as an alternative to (half of) Angular.

RxJS is a reactive programming library. It is usually used as a tool to accomplish asynchronous tasks in JavaScript. Think of it as an alternative to Promises.


Reactive programming is a paradigm (way of working and thinking) where data changes are observed from a distance. Data is not changed from a distance.

Here is an example of changed from a distance:

// In the controller.js file
model.set('name', 'George');

The Model is changed from the Controller.

Here is an example of observed from a distance:

// logger.js
store.subscribe(function (data) {
    console.log(data);
});

In the Logger, we observe the data changes that happen in Store (from a distance), and write to the console.


Redux uses the Reactive paradigm just a little bit: the Store is reactive. You do not set its content from a distance. That’s why there is no store.set() in Redux. The Store observes actions from a distance, and changes itself. And the Store allows others to observe its data from a distance.

RxJS also uses the Reactive paradigm, but instead of being an architecture, it gives you basic building blocks, Observables, to accomplish this “observing from a distance” pattern.

To conclude, very different things for different purposes, but share some ideas.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)