We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8cdeb49 commit 4406486Copy full SHA for 4406486
src/components/TodoApp.jsx
@@ -38,15 +38,19 @@ const todoReducer = (state, action) => {
38
let temp;
39
switch (action.type) {
40
case 'do':
41
- return state.map((todo) => {
+ temp = state.map((todo) => {
42
if (todo.id === action.id) return { ...todo, complete: true };
43
return todo;
44
});
45
+ localStorage.setItem('solvoyo-todo', JSON.stringify(temp));
46
+ return temp;
47
case 'undo':
48
49
if (todo.id === action.id) return { ...todo, complete: false };
50
51
52
53
54
case 'add':
55
temp = state.concat({
56
task: action.task,
0 commit comments