mirror of
https://github.com/microsoft/frontend-bootcamp.git
synced 2026-01-26 14:56:42 +08:00
added more notes to step 2.8 and hints about bonus exercise
This commit is contained in:
@@ -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 };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user