Closed
Description
Do you want to request a feature or report a bug?
Bug/Question
What is the current behavior?
When I retrieve a value from a useState hook inside a setTimeout function, the value is the one when the function was called and not when the code inside gets executed.
You can try here, just increase the counter then start the timeout and increase the counter again before the timeout expires.
https://codesandbox.io/s/2190jjw6op
What is the expected behavior?
Retrieving the updated state.
If instead it's working as intended how I can retrieve the updated status?
Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
16.7.0-alpha.0
Metadata
Metadata
Assignees
Labels
No labels