Solid js context turns out undefined. What's happening? #2564
Replies: 1 comment
-
|
I found a solution to the problem... Move the context creation to a new file: PaletteCreateContext.tsx Import PaletteCreateContext into the context file.
... That makes the useContext work again without having to reload it every time the HMR (Hot Module Replacement) is fired. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm working on a project in Solid-js. Until a few days ago it worked fine…
But suddenly it gives me the following error:
ColorEditOpacityValue.tsx:9 Uncaught (in promise) TypeError: Cannot destructure property 'color' of 'usePaletteContext(...)' as it is undefined.Everytime I save a file in development mode!
I have 3 context files surrounding the APP component and as far as I can see it’s only the usePaletteContext(...) that becomes undefined.
In the index.tsx file the context providers are wrapped like this
Every component that needs the context is setup as follows
The following is the context file in its self:
As I only see the problem with the
usePaletteContextfile I was wondering if the file is getting too big?Or else how come it suddenly starts giving me problems and what can be done to solve it?
I have also looked into the Development HMR (Hot Module Replacement) issues, but I can’t find any way to solve it if that’s the problem…
/Bo
Beta Was this translation helpful? Give feedback.
All reactions