CoreBeginner40 min read
2. Props & state
React Basics · 16 pages source format
Props in, state inside, events up.
What you'll learn
- useState
- Props
- Controlled inputs
Key idea
Props are inputs from parents. State is data that changes over time inside a component.
Quick check
Updating state should…
Do this now
Write 3 notes on: Props & state.
Clear?
Practice
Build a counter and a controlled text field.
const [n, setN] = useState(0)
return <button onClick={() => setN(n + 1)}>{n}</button>Do this now
Commit one file practicing Props & state.
Clear?