React documentation
Follow the official component and state tutorials.
Free documentation.
Explore toolLesson 2 of 3 · 11 min
useState gives a component memory: const [count, setCount] = useState(0).
Calling the setter re-renders the component with the new value — never mutate state directly.
Build a counter with a button that increases the number each click.
Optional resources
No purchase or partner signup is required to complete this course or earn quiz points.
These are official product links, not active affiliate links. Learnly does not currently earn a commission from them.
Follow the official component and state tutorials.
Free documentation.
Explore toolPrototype React components in the browser.
Free tier available; paid plans optional.
Explore tool