State with useState
useState returns the current value and a setter. Calling the setter re-renders the component.
Example
const [on, setOn] = useState(false);
Your task
Create a count state starting at 0 and a button that adds one.
React & Modern Frontend
useState returns the current value and a setter. Calling the setter re-renders the component.
const [on, setOn] = useState(false);
Create a count state starting at 0 and a button that adds one.
This lesson is checked against the lesson rules. Your code is never run on our servers.