There are 3 principle of redux
- Everything changes in application including data or ui change is placed in single object called state / state tree.
- State tree is readonly. You can not modify or write. To change state dispatch actions.
- State : minimumal representation of the data to the app.
- Action : minimumal representation of change to the data.
- return value depent solely on the given argument.
- Do not have any side effect ( network/db call )
- They dont modify value passed to them.
- call database / network
- they may override value passed to them.
- is most predictable when it is described by pure function of the application state. F(S)
- State mutation should be described by pure function.
- It takes the previous state of the whole application and the action being dispatched and return new state.
- It doesnot mutate the state.
- To describe state mutation write a pure function that takes previous state of the app and the action dispatched and returns the next state of the app.
- This function is called reducer.