Practice Challenges

1. React Todo List (CRUD)

EasyHooks & State

Implement a reducer for a Todo list. Handle 'ADD', 'TOGGLE', 'UPDATE_TEXT', and 'DELETE' actions. State is an array of objects: { id, text, completed }.

No global variables, No side effects, No external dependencies

Closure, Variable, Function

todoReducer([{ id: 1, text: 'Task 1', completed: false }], { type: 'UPDATE_TEXT', payload: { id: 1, text: 'Updated Task' } }) -> [{ id: 1, text: 'Updated Task', completed: false }]

Time: O(n), Space: O(1)

Loading...