DEV Community

mike
mike

Posted on

React Hook update inconsistencies

I have a component that unexpectedly prints the result after executing the click event
Image description
The print result of the first two clicks is expected, but the print result of the third click is unexpected. May I ask why?

Top comments (1)

Collapse
 
pcelac profile image
Aleks

Put count variable outside of App() function.