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

[Suggestion]: Section from useContext might not be entirely accurate #6739

Open
gmoniava opened this issue Apr 8, 2024 · 0 comments
Open

Comments

@gmoniava
Copy link

gmoniava commented Apr 8, 2024

Summary

There is a paragraph about re-rendering of children when parent re-renders which doesn't seem to be accurate, see below.

Page

https://react.dev/reference/react/useContext#optimizing-re-renders-when-passing-objects-and-functions

Details

Here: https://react.dev/reference/react/useContext#optimizing-re-renders-when-passing-objects-and-functions,
it says in the bottom of the section:

As a result of this change, even if MyApp needs to re-render, the components calling useContext(AuthContext) won’t need to re-render unless currentUser has changed.

This is not entirely true. because if MyApp re-renders, all of its children (including those consuming the context) will re-render by default, regardless if currentUser has changed or not.

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

No branches or pull requests

1 participant