Hot reload of React context provider causes default value to be given to consumers #1555
Unanswered
jugglingcats
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, am using
React.useContext
in my project. All works fine except that if I change the tsx containing thecreateContext
call it causes the default context to be provided to consumers which breaks the app so I have to refresh the entire page to continue.If I move the
createContext
into a separate source file it works (unless I change that file).Full example project at https://github.com/jugglingcats/snowpack-test.
Curious why this should be and whether it's fixable. Moving
createContext
is a reasonable workaround actually as it will only change if I need to change the context type.Also want to say that Snowpack is amazing... thank you!
Beta Was this translation helpful? Give feedback.
All reactions