Files
frontend-bootcamp/docs/step2-05/exercise/src/reducers/index.ts
T
2019-02-19 23:41:11 -08:00

17 lines
386 B
TypeScript

import { Store } from '../store';
import { addTodo, remove, complete } from './pureFunctions';
export function reducer(state: Store['todos'], payload: any): Store['todos'] {
switch (payload.type) {
case 'addTodo':
return addTodo(state, payload.id, payload.label);
// Fill in the blanks here for:
// - remove
// - complete
// - clear
}
return state;
}