Close the earlier lessons and build this from the brief. data.js has the
columns and the starter cards.
The brief
- Three columns from
columns, each headed with its title and a count, such as To do (2). - A search box above the board that filters cards by title, ignoring case. The counts show matching cards only. Next to it, 4 of 4 cards, updated as you type.
- Clicking a card's title selects it, outlines it, and shows a details panel under the board with its title, column name and minutes.
- The panel has a Move right button that moves the card to the next column. It's disabled in Done.
Acceptance checks:
- Select Read about reducers and press Move right twice: it ends in Done, the panel follows it, and Move right is disabled.
- Search for try: only Try context is left, and the counts read To do (1), Doing (0), Done (0).
- Your state holds the cards, the search text and the selected id. Nothing else.
Runs with Vite on your computer: unzip, then
npm install and npm run dev. Hint 1: the plan
Do the five steps from the first lesson on paper first. You need App, a
Board (or Columns), and a Details panel. Three pieces of state, all in
App.
Hint 2: moving right
Find the card's column index in columns, and take the next one:
columns[columns.findIndex((c) => c.id === card.column) + 1]. It's undefined
past the last column.
Show one solution
Runs with Vite on your computer: unzip, then
npm install and npm run dev. Check yourself
- Why store the selected card's id rather than the card?
- Name two derived values on this board, and say why neither is state.
- When does React keep a component's state, and how do you make it start fresh?
Completion is saved in this browser only. It does not measure mastery.