Passing context to components that are included as custom elements #114
-
Greetings, I have a situation where pages with preact components are generated statically, it works well except when passing contexts between these components. The scenarios are, on a very high level: Scenario #1 comp1 and comp2 are preact components, register themselves as custom elements, and are served statically. comp1 and comp2 define a provider and children, generated via tsx get the context correctly. It will be a distinct provider.
Scenario #2 - The desired one root-comp, comp1 and comp2 are preact components, register themselves as custom elements, and are served statically. root-comp defines a provider and children, generated via tsx or included statically as custom elements get the context correctly. It will be a unique provider. Does not work. Provider context is not available in children of root-comp.
root-comp is defined, more or less like:
If a child is inserted directly in root-comp rendered children, it will of course receive the provider. Children included as custom elements, statically, will not.
aChild will get the context, all other children, below, will not. Any help? I cannot change the requirement of statically generated DOM so, need to find a way around. |
Beta Was this translation helpful? Give feedback.
Replies: 0 comments 3 replies
-
What does this mean?
Edit: Nope, I was totally wrong/misremembering. Here's an example |
Beta Was this translation helpful? Give feedback.
What does this mean?
Regardless though, no, I don't believe there's any way to access context values across custom elements at the moment.Edit: Nope, I was totally wrong/misremembering. Here's an example