added more notes to step 2.8 and hints about bonus exercise

This commit is contained in:
Ken
2019-02-22 19:42:53 -08:00
parent cbef653685
commit 78368cdf39
2 changed files with 49 additions and 0 deletions

View File

@@ -1,9 +1,21 @@
import { Store, FilterTypes } from '../store';
import produce from 'immer';
export function addTodo(state: Store['todos'], id: string, label: string): Store['todos'] {
return { ...state, [id]: { label, completed: false } };
}
/* For the bonus exercise
export function addTodo(state: Store['todos'], id: string, label: string): Store['todos'] {
return produce(state, draft => {
// TODO: implement a simple obj key assignment here
});
}
*/
export function remove(state: Store['todos'], id: string) {
const newTodos = { ...state };