August 2017
Beginner
374 pages
10h 41m
English
The counter is controlled by a counterReducer in src/reducers/counter.js:
import { INCREMENT, DECREMENT, RESET } from '../actionTypes'export default function counterReducer (state = 0, action) { switch (action.type) {
Its logic is quite simple:
case INCREMENT: return state + 1
case DECREMENT: return state - 1
case RESET: return 0
default: return state }}
Read now
Unlock full access