Stage 2 · Lesson 6 of 10
State with useState
useState gives a component a value that survives , plus a setter function that schedules a new render. This is local UI state. Treat it as : never change it in place.
Make a new array or object with the instead of pushing into the existing one, or React will not see the change. When the next value depends on the previous one, pass a function, as in setCount(c => c + 1). Keep state in the component that uses it, and pass values and down as props. and sharing it across screens come in the next stage.
Common trapstoring derived data, such as a filtered list, in its own state, which then drifts from the source list.
A question to check yourself, an AI practice session and 2 cheat sheet entries come with the full roadmap. Unlock
Resources for this stage
Start with· follow one of these
- GuideFreeExpo Documentation
Expo
The Expo tutorial builds a small app you run on your own phone
- GuideFreeReact Documentation
Meta
"Describing the UI" and "Adding interactivity" cover the React you need