DEV Community

Discussion on: How to use React Hooks to create a Counter Component

Collapse
 
maxim218 profile image
maxim218

I am sorry, but I did not understand the answer about setCount(prevCount => prevCount + 1);
As for me I think, that approach setCount(count + 1) is simplier then your solution.
If I write the code setCount(count + 1) will it correct work, or I am making a mistake
Thank you!