Guest User

Untitled

a guest
Mar 19th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. #### Principles of redux
  2. 1. The entire UI is represented in a single object called *state tree*.
  3. 1. The state is *immutable*. Use actions (object) to describe a change and pass it to reducer (function) to create a new state tree.
  4. 1. The reducers are pure functions.
  5.  
  6. #### Reducer signature
  7. ```
  8. const exampleReducer = (prevState, actionObj) => {
  9. return nextState; //don't change/modify prevState to create this
  10. }
  11. ```
  12.  
  13. #### CreateStore method is used to create a redux store. it has 3 main methods
  14. 1. getState()
  15. 1. dispatch() - this takes action obj as parameter
  16. 1. register() - this takes callback to be excecuted after an action is dispatched
  17.  
  18. #### CombineReducers utility function of redux is used to combine all clild reducers.
Add Comment
Please, Sign In to add comment