Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Callback on nested setState doesn't called with update state #1741

Closed
edimitchel opened this issue Jun 27, 2019 · 0 comments · Fixed by #1748
Closed

Callback on nested setState doesn't called with update state #1741

edimitchel opened this issue Jun 27, 2019 · 0 comments · Fixed by #1748

Comments

@edimitchel
Copy link

edimitchel commented Jun 27, 2019

Hi !

On this issue (#556), I discuss with @JoviDeCroock about an issue when I use setState on the componentWillDidMount.

My issue concerns the callback of a nested setState (into another setState callback). The state inside the nested callback is not updated (was it called at the same time as the parent callback ?). This weird way to handle state is not mine, it's a legacy code, but it's usefull for some SSR needs (we use same components for React, React with SSR and Preact).

You can see the wrong behavior on this codesandbox.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant