Lesson 02 · React
State: When a Component Remembers
Props flow down and cannot change; state is the memory a component owns. Learn useState, what a re-render really is, immutable updates, and lifting state up so siblings share one truth.
Prerequisites: Components: Thinking in Pieces
Learning objectives
By the end of this lesson, you will be able to:
- Choose between props and state for a given piece of data
- Write components that remember values with useState and explain what triggers a re-render
- Update array and object state immutably, using functional updates when the next value depends on the last
- Lift shared state to the closest common parent and keep a single source of truth