Prague Itinerary Component Tree

Prague itinerary: component tree

Four components, one reducer. All task state lives in TaskApp. Everything below it receives data as props and reports changes through callbacks.

Component DOM element Conditional branch state owns state prop received prop

What happens when you tick a task

Taskcheckbox onChange
onChange{ ...task, done: true }
TaskApphandleChangeTask(task)
dispatch{ type: "changed", task }
tasksReducerreturns a new tasks array
Re-renderTaskApp → TaskList → Task

Where the logic lives

TaskReducer.js

A pure function (tasks, action) → tasks. Called by React, never by a component directly.

"added" → append "changed" → map "deleted" → filter

Local state stays local

AddTask.text and Task.isEditing only affect their own component, so they never go through the reducer.

Seed data

Kafka Museum (done), puppet show, Lennon Wall pic. New ids start at 3 through nextId++.