InterviewSolution
| 1. |
What are reducers in redux? |
|
Answer» The reducers in redux are the pure functions that take the previous state and an action, and then it returns to the NEXT state. It is known as the reducer because they are the TYPE of function that would pass to Array.prototype.reduce(reducer, ?initialValue). It is very essential to ensure that the reducer stays pure. To MAINTAIN this, there are few things that you should never do INSIDE the reducer:
const initialState = { value: 0 } function counterReducer(state = initialState, action) { |
|