SolidJSS
SolidJSโ€ข2mo agoโ€ข
8 replies
Optimum

SolidJS Context Helpers

I found this guide for creating strongly-typed Context: https://gist.github.com/JLarky/a46055f673a2cb021db1a34449e3be07

It's a bit old, but it seems to still mostly be the way to do it. However, in my project I had tried to make "helpers" like in the example (useIsDark, useSetDark), but I always get a "context undefined" error. When I directly use the context, it works. Is there a different method of creating helpers?
Gist
Ultimate example of solidjs context hook with nice type-safe (TypeScript) wrappers and reduced boilerplate by using ReturnType - README.md
Ultimate example of solidjs context hook with nice type-safe (TypeS...
Was this page helpful?