August 2017
Beginner
374 pages
10h 41m
English
Now that we have implemented a generic higher-order reducer that can make our counter reducer undoable, we can remove the undo/redo logic completely from the reducer.
Replace the contents of the src/reducers/counter.js file with the following code:
import { INCREMENT, DECREMENT, RESET } from '../actionTypes'export default function counterReducer (state = 0, action) { switch (action.type) { case INCREMENT: return state + 1 case DECREMENT: return state - 1 case RESET: return 0 default: return state }}
Read now
Unlock full access