[Suggestion]: Section from useContext might not be entirely accurate
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 11.8k
- Forks
- 7.9k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 11
Description
Summary
There is a paragraph about re-rendering of children when parent re-renders which doesn't seem to be accurate, see below.
Page
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. Unless there was React.memo used - but this is not mentioned in that part of the docs.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Open the useContext reference at the “Optimizing re-renders when passing objects and functions” section and review the quoted statement about MyApp re-rendering. Verify the behavior described there, then revise the documentation so its re-rendering conditions are accurate and run the documentation checks before submitting.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 62/100