This commit is contained in:
dmitry-vsl
2025-05-30 19:59:02 +00:00
parent 1a30311de4
commit 75b1c5e942
30 changed files with 959 additions and 832 deletions

View File

@@ -1,18 +1,16 @@
const todos = (state = [], action) => {
if(action.type == 'ADD_TODO') {
if (action.type == "ADD_TODO") {
return [
...state,
{
id: action.id,
text: action.text,
completed: false
}
completed: false,
},
]
} else if(action.type == 'TOGGLE_TODO') {
} else if (action.type == "TOGGLE_TODO") {
return state.map(todo =>
(todo.id === action.id)
? {...todo, completed: !todo.completed}
: todo
todo.id === action.id ? { ...todo, completed: !todo.completed } : todo,
)
} else {
return state