0
Challenge · 11React Core

State (useState)

Coreused in ~100% of apps

A plain variable resets to its starting value every render, so the screen can never change. State is the memory React keeps for you between renders — the moment a component must remember anything, you reach for useState.

Core idea. useState gives a component a value React remembers across renders, plus a setter that — when called — stores a new value and schedules a re-render so the UI catches up.
Playground, this isn't a screenshot
<Counter />re-rendered 1×
React's box:0
const [count, setCount] = useState(0)

Each click writes a new value into React's box and schedules a re-render — the box keeps its value between renders, the variable doesn't.

↑ play a little first, then dig in