Guided Notes
State with useState
Data that changes over time: useState, updating state safely, and how re-renders work.
What state is
Slide 1 / 5Props come from outside a component. State is data a component owns and can change: a counter's value, whether a menu is open, what's typed in a box.
A plain variable won't work:
let count = 0; // resets on every render, count++; // and changing it doesn't re-render
React needs two things: a value that survives between renders, and a way to tell React it changed so it can redraw. The useState hook gives you both.
