Understanding Redux

What is Redux?

It is a JavaScript Library for managing application state. State nothing but data (JavaScript object).

Redux will help you with data management for your web applications.

Let’s say, applications keeps increasing complexity. Every new features makes harder to think about how views and models communicate.

Facebook was faced problems with the MVC structure. They faced complexity on communication between Models and Views like infinite loops etc. So they introduced Flux.

Flux is a unidirectional way of modifying View and handling user actions.

Redux uses this same concept of unidirectional data flow.

  • Application will have Central state, we can call it as Root object/state.
  • Whenever that object/state change, View will automatically updates.
  • There are few functions help us to change/modify that object/state
  • When user trigger any events or user interactions triggers these functions

What is unidirectional data flow?

Here State cannot trigger any further actions. It just modify based on user actions. So there is no difficult for infinite loops.

So unidirectional data flow nothing but, when user perform any action (Action), that action will trig special functions (Reducers) And that special function will modify root object (State)

When root object modified then View will be updated automatically