S
SolidJS2y ago
Neto

Context hierarchy

I was using the create context and such, and found a weird behaviour that even with a context hierarchy still using default values
<CounterProvider> // context provider is here
<App/> // counter is here but still using default behaviour
</ContextProvider>
<CounterProvider> // context provider is here
<App/> // counter is here but still using default behaviour
</ContextProvider>
Especially with the quote from the docs Default Context is used when no Provider is found above in the hierarchy. Stackblitz with example https://stackblitz.com/edit/solidjs-templates-zeprsr?file=src%2Findex.tsx,src%2Flib%2FCounterProvider.tsx,src%2FApp.tsx And there a bug or im missing something?
2 Replies
lxsmnsyc
lxsmnsyc2y ago
yes, you're destructuring children in CounterProvider, which means App gets constructed first
Neto
NetoOP2y ago
That makes sense Thanks
Want results from more Discord servers?
Add your server