← React Intermediate Questions - Set 9 Q86

How do you update the state of a functional component in React?

React Intermediate Questions - Set 9

Example

const [n, setN] = useState(0);
setN(n + 1);
// never: n = n + 1

What to notice

← Back to the question list