- 1 current stop: learning
- 2 upcoming
- 3 upcoming
- 4 upcoming
- 5 upcoming
Finish after stop 5
Stop 1 of 5 · Bike shop: the whiteboard wall
Trick to keep in mind+3 XP
A plain variable is a whiteboard wiped each render; state is a notebook React keeps.
A component is a function that runs again on every render, so anything declared inside it starts from scratch each time. Changing a plain variable also does not tell React that anything happened, so the screen stays as it was. State lives outside the function call, survives between renders, and its setter is how you ask for a new one.
Read it once, then a question tests whether the trick stuck.