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
I'm looking for a way to use context with a bindable prop state. The documentation describes how you need to pass a $state object to the context in order for it to be reactive. However, I would like to use a $state that is coming in as a bindable property, this does not seem to work.
If possible, I would like bindable states to be reactive out of the box. Alternatively, it would be nice to have some documentation on how to implement this pattern.
Importance
would make my life easier
The text was updated successfully, but these errors were encountered:
leekeh
changed the title
How to combine
How to combine bindable state prop + context
Feb 5, 2025
Context isn't inherently reactive; to use reactive primitives in context, you'd have to wrap it with a callback or accessor property. You could try something like this.
Context isn't inherently reactive; to use reactive primitives in context, you'd have to wrap it with a callback or accessor property. You could try something like this.
Thanks, that did work for my specific issue. It would be nice to have a bit more info on this behavior and why it works this way in the documentation.
Describe the problem
I'm looking for a way to use context with a bindable prop state. The documentation describes how you need to pass a
$state
object to the context in order for it to be reactive. However, I would like to use a $state that is coming in as a bindable property, this does not seem to work.Here is a REPL of the situation: https://svelte.dev/playground/86a850f39b684dbf8541d595d1f60257?version=5.19.7
Describe the proposed solution
If possible, I would like bindable states to be reactive out of the box. Alternatively, it would be nice to have some documentation on how to implement this pattern.
Importance
would make my life easier
The text was updated successfully, but these errors were encountered: