Skip to content

Providing context to children #1420

Answered by gbj
syakupov asked this question in Q&A
Jul 23, 2023 · 2 comments · 3 replies
Discussion options

You must be logged in to vote

Ah, okay. So, let me take another try at this that doesn't cheat by introducing a new component, and might be closer to what you need.

For what it's worth: I think the core issue here is that without the blessing of a virtual DOM (and the curse of its overhead), and because components don't re-run when state changes, Leptos tends to construct things eagerly: in this case, children is lazy, but each individual child node is not, so as soon as you call children(cx), all the children are built.

So the model of wrapping components in context providers is never quite going to work exactly the same, because the control flow is just different enough between the two frameworks.

However, we can st…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@syakupov
Comment options

Comment options

You must be logged in to vote
2 replies
@syakupov
Comment options

@gbj
Comment options

Answer selected by syakupov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants