← React Intermediate Questions - Set 9 Q86
How do you update the state of a functional component in React?
React Intermediate Questions - Set 9
Example
1
setCount(c => c + 1); // functional update reads the latest value
What to notice
- Use the updater whenever the new value depends on the old one.
← Back to the question list