/  Technology   /  What are downsides of redux compared to flux in ReactJS?
what are downsides of redux compared to flux

What are downsides of redux compared to flux in ReactJS?

 

React Flux is a pattern and React Redux is a library.

Flux is the application architecture and/or we can say JavaScript(JS) architecture that uses for building client-side web applications or UI for client applications. you can start using react flux without a lot of new code. React flux overcome the drawbacks of MVC (Model-View-Controller) pattern such as instability and complexity

 In React Flux, an action is a simple JavaScript object, and that is the default case in React Redux too, but when using React Redux middleware, actions can also be functions and promises.

With React Flux it is a convention to have multiple stores per application; each store is a singleton object. In React Redux, the convention is to have a single store per application.

React Flux has a single dispatcher and all redux actions must pass through that dispatcher. A react Flux web application cannot have multiple dispatchers. React Redux has no dispatcher entity. Instead, the reacr store has the dispatching process baked in. A React Redux store exposes a few simple API(Application programming interface) functions, one of them is to dispatch actions.

The state’s immutability, in React Redux and no such constraint in React Flux, you can mutate the state as you wish.

what are downsides of redux compared to flux

In Redux the Data logic is the reducer and in flux the data logic is in the store.

React Redux is able to cut some complexity corners by providing react functional composition where react Flux uses callback registration.

Redux has a rich and fast growing ecosystem. This is because it using a few extension points such as react middleware. It was designed with use cases such as logging, support for Promisses,Observables,routing,Immutability, dev checks and persistence, etc, in mind. Not all of these will turn out to be useful, but it is nice to have access to a set of tools that can be easily combined to work together.

React Redux conserves all the benefits of React Flux (recording and replaying of actions, and unidirectional data flow, dependent mutations), and adds new benefits (easy undo-redo, hot reloading) without introducing Dispatcher and store registration.

Keeping it simple is priority because it keeps you sane while you implement higher-level abstractions.

Thus These are some of the differences and downsides of react redux when compared to flux.

 

Leave a comment