Course · Section 17: Modern JavaScript Development: Modules, Tooling, and Functional · Lecture 294: Declarative and Functional JavaScript Principles
Implement `todosReducer(state, action)` where `state` is an array of `{ id, text, done }`. Handle `{ type: 'add', todo }` (append), `{ type: 'toggle', id }` (flip that todo's `done`), and `{ type: 'remove', id }` (delete it). Unknown actions return state unchanged.
+ 2 hidden tests run on Submit.
A list reducer derives the next array from the current one. add appends immutably, toggle maps to a new array flipping one item via an object spread, and remove filters it out. Unknown actions fall through unchanged.
Run your code to see results.