-
In short: More explanation of problem:
Every component has the store implementation of interface like this (with RecipeItem and ProductItem type in generic):
We get instance of store like this:
If we don't provide key in Usage code:
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Thanks for the answer. If you have only one |
Beta Was this translation helpful? Give feedback.
-
In my case it doesn't work automatically :)
|
Beta Was this translation helpful? Give feedback.
-
I checked the sample, it doesn't work because you are creating both components with the same ComponentContext here. As I mentioned earlier, sharing component contexts between multiple components is error prone and discouraged. There are two options:
In this case you won't need specifying keys in child components. |
Beta Was this translation helpful? Give feedback.
I checked the sample, it doesn't work because you are creating both components with the same ComponentContext here. As I mentioned earlier, sharing component contexts between multiple components is error prone and discouraged.
There are two options:
childContext
for every child component.addFoodEntry(componentContext.childContext("food"))
, and similarity for the second component.In this case you won't need specifying keys in child components.