You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i see that like any usage of contextAPI, each child that is under the provider is getting rendered.
i found that if i wrap the functions that are under that provider with React.memo it will prevent unneeded renders
was wondering what you think about this, did constate handle this issue? i could not find in the docs.
Enhancing a component with React.memo makes it render only when its props change. It doesn't work when a component is using useContext underneath (like Button and Count) because it's relying on a state that doesn't come from props.
But you can use React.memo on other (pure) components inside the Provider if you're having performance issues.
i see that like any usage of contextAPI, each child that is under the provider is getting rendered.
i found that if i wrap the functions that are under that provider with React.memo it will prevent unneeded renders
was wondering what you think about this, did constate handle this issue? i could not find in the docs.
This is the code change:
The text was updated successfully, but these errors were encountered: