Context uses default value instead of one passed to provider
Hi!
I've just started a new project using solid for the first time.
as someone that comes from the react world, using context with createSignal seemed practically the same to me as in react, so I made a simple context to try it out.
and then I wrapped with it the router of my app.
and then I tried accessing it at two different places within the component tree.
but I just get the default values of the context (not the signal or the locale switcher, but the default value, and an empty function).
Can anyone help me with some insight into why it happens? because I'm really confused...
1 Reply
This is the issue
({ children }) => {
you are destructuring
basically you are rendering the children first before the parent.