adding some redux steps

This commit is contained in:
Ken Chau
2019-02-16 17:00:47 -08:00
parent e143a0e820
commit 7fc326b0cb
22 changed files with 2096 additions and 2173 deletions

View File

@@ -0,0 +1,19 @@
import { Store } from '../store';
import { addTodo, remove, complete } from './pureFunctions';
let index = 0;
export function reducer(state: Store, payload: any): Store {
switch (payload.type) {
case 'addTodo':
return addTodo(state, payload.label);
case 'remove':
return remove(state, payload.id);
case 'complete':
return complete(state, payload.id);
}
return state;
}