How to update the entire context when a consumer modifies a value #4639
Unanswered
igmansilla
asked this question in
Q&A
Replies: 1 comment
-
If I understand correctly, the issue is that mutating the contents of the context object being shared doesn't propagate that change to wherever that context object sub-property is being rendered. If you'd like to provide a playground subset showing the problem, we can provide a specific fix that follows this general pattern... You'll need to make sure wherever you're consuming the context data reacts to the change in the data. There are a few ways to do this and it depends on how you're consuming the data down the component tree:
|
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
-
Hello everyone,
I'm working on a project using Lit Element, and I'm utilizing context to share data between different components. However, I've encountered an issue when trying to update the entire context when a consumer modifies a value.
Here's my scenario: I have a provider that provides a context with multiple values. Several consumers use these values in different parts of my application. Now, when one of the consumers modifies a value in the context, I want all other consumers using that context to automatically update with the new value.
Is there any way to achieve this using Lit Element's context system? Or is there any recommended strategy for handling this type of situation?
I would greatly appreciate any guidance or suggestions you can offer.
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions