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

Strict Mode: Document behavior of setState callbacks #6559

Closed
fefrei opened this issue Jan 19, 2024 · 2 comments
Closed

Strict Mode: Document behavior of setState callbacks #6559

fefrei opened this issue Jan 19, 2024 · 2 comments

Comments

@fefrei
Copy link

fefrei commented Jan 19, 2024

As per the documentation, Strict Mode has three effects:

As per his issue comment, “setState updaters will run twice in strict mode in development”. I think this behavior should be documented on the Strict Mode page.

@rickhanlonii
Copy link
Member

Yes, this is documented on that same page here and in the docs for setState here.

@fefrei
Copy link
Author

fefrei commented Feb 12, 2024

I see, looks like I overread them, thanks. There might still be room for improvement, though: The list I quoted above is titled “Strict Mode enables the following development-only behaviors”, making it sound (to me) like it's an exhaustive lists of what strict mode does. This is what confused me – I saw some weird behavior due to a bug in my code, wondered whether this might be triggered do to the setState updater being run twice, saw the (exhaustive‽) list above, and discarded that theory. Maybe this list can be completed, or re-worded as just an example of the types of changes strict mode enables?

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

No branches or pull requests

2 participants