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
{{ message }}
This repository was archived by the owner on Sep 17, 2024. It is now read-only.
I use Context to inject some data globally, and I optimize the access to children according to the examples given in the tutorial, that is, using the children utility function to wrap props.children. However, the child components always access the initialValue of createContext through useContext, instead of the data I provide through Provider.
Please comment out this IS NOT WORK code, 16-19 lines.
Than comment in IS WORK code, 22-24 lines.
Butten Render -2, this is provide by Context.Provider.
Expected behavior
I hope that when using the children utility function, the child components will not be initialized in advance, causing useContext to be unable to get the provided value.