Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

flux vs redux pros and cons highlights

Tags:

flux

redux

state

I'm new to flux/redux data flow, and I try to understand the main differences between them.

Can you please highlight the differences? Such as pros and cons for each one?

Thanks

like image 653
Shai M. Avatar asked Sep 24 '15 12:09

Shai M.


People also ask

Which is better flux or Redux?

The primary difference of Flux vs Redux is that Flux includes multiple Stores per app, but Redux includes a single Store per app. Rather than placing state information in multiple Stores across the application, Redux keeps everything in one region of the app.

What are the downsides of Redux compared to flux?

Flux is unopinionated about mutating data, but Redux doesn't like mutations and many packages complementary to Redux assume you never mutate the state. You can enforce this with dev-only packages like redux-immutable-state-invariant, use Immutable.

Does Facebook use flux or Redux?

Flux is the application architecture that Facebook uses for building client-side web applications.

What are the advantages of flux over traditional MVC pattern?

Advantages of using Flux:Flux manages complicated interactions between data resources. Flux has a unidirectional data flow. Which means it is easier to manage the data flow.


1 Answers

The shortest, simplest answer is Flux has multiple stores and a central dispatcher to manage communication to those stores.

Redux only has one store and encourages using simple reducer functions to interact with various properties on the store.

This strategy makes it easy to reason about the overall state of your application (it's just one massive POJO) and allows for awesome devtools like time-travel debugging and hotswapping state.

There's a more detailed explanation (that does a far better job of explaining) in the official docs.

like image 140
travisbloom Avatar answered Sep 16 '22 15:09

travisbloom