August 2017
Beginner
374 pages
10h 41m
English
After defining the application state and actions, we still need a way to apply actions to change the application state. In Redux, the state is updated through special functions called reducers. Reducers contain the state changing logic of our application.
newState = reducer(state, action)
A reducer function takes the current state object and an action object as arguments. The reducer parses the action object, specifically, the action.type. Depending on the action type, the reducer function either returns a new state, or it simply returns the current state (if the action type is not handled in this reducer).
To write a function, we first have to think of the function signature (the head of the function). A ...
Read now
Unlock full access