[Proposal] Selective Render with useContext #26890
Labels
Resolution: Stale
Automatically closed due to inactivity
Status: Unconfirmed
A potential issue that we haven't yet confirmed as a bug
Ability to do selective renders with useContext to improve the performance for large applications
following the next pattern
React version: 18.2.0
Steps To Reproduce
https://codesandbox.io/s/friendly-bas-5vnrvs
The current behavior
all context consumers are re-rendering
The expected behavior
should only re-render those that were affected using the proposal that is in codesandbox
Note
this proposal is to give a big improvement in performance for large application that works based on contexts, so instead be making granual contexts, why not give the ability to check if the value that is expecting the consumer change or not
this can be implemented in the logic that process the nodes and takes the decision to re-render or not internally in react, but im not familiar to try to make a PR for this proposal
Updated:
after some research the files that needs to be updated are
is this correct ?
noticed that when the provider Fiber gets updated this sends the signal to invalidate all consumers located in the child tree inside the provider
The text was updated successfully, but these errors were encountered: