Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #### Principles of redux
- 1. The entire UI is represented in a single object called *state tree*.
- 1. The state is *immutable*. Use actions (object) to describe a change and pass it to reducer (function) to create a new state tree.
- 1. The reducers are pure functions.
- #### Reducer signature
- ```
- const exampleReducer = (prevState, actionObj) => {
- return nextState; //don't change/modify prevState to create this
- }
- ```
- #### CreateStore method is used to create a redux store. it has 3 main methods
- 1. getState()
- 1. dispatch() - this takes action obj as parameter
- 1. register() - this takes callback to be excecuted after an action is dispatched
- #### CombineReducers utility function of redux is used to combine all clild reducers.
Add Comment
Please, Sign In to add comment