Replies: 2 comments
-
This should work on the client side. |
Beta Was this translation helpful? Give feedback.
0 replies
-
@smblee - did you find solution for this? |
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
-
I am having some trouble working with the Svelte's context store with sveltekit as I am constantly running into context API not being instantiated in SSR context and getting an error. I want to be able to consume my context with a simple syntax like
where getDatalistContext would be an encapsulation of
getContext
But this of course doesn't work and will throw since
getDatalistContext()
will be called beforesetDatalistContext
is called.In order to get around this, we can instantiate
context
variable within the samebrowser
block but then its not as ergonomic to do addcontext?.
in front of all accessors.(And this becomes even more difficult to manage if this context is used across related child components, which is what i do).
Would love to see what other folks have done to elegantly use the context API within Sveltekit!
Beta Was this translation helpful? Give feedback.
All reactions