Children helper break Context

I made a snippet to better show the problem, I tried looping the props.children instead of using the helper but it didn't really work https://playground.solidjs.com/anonymous/2ad2d60f-5f41-4a3b-abf5-6f9507c6c248
Solid Playground
Quickly discover what the solid compiler will generate from your JSX template
2 Replies
Otonashi
Otonashi2y ago
children evaluates the children, so in this case it is outside the context either do children(() => <Provider>{props.children}</Provider>) or use a second component inside the context provider and use the children helper there i.e.
const Group = () => {
const Inner = () => {
const c = children(...);
createEffect(() => {
c()...;
});
return <>{c()}</>;
};
return <Provider value={context}><Inner /></Provider>;
}
const Group = () => {
const Inner = () => {
const c = children(...);
createEffect(() => {
c()...;
});
return <>{c()}</>;
};
return <Provider value={context}><Inner /></Provider>;
}
Ladvace
LadvaceOP2y ago
got it, thanks!
Want results from more Discord servers?
Add your server