Provider context isn't being executed on SSR website before child component?
Hi,
I'm working on a website for work and I'm attempting to insert a provider as the parent of a child page in InertiaJS,
Welcome.tsx
@/Layouts/SiteLayout.tsx
@/Contexts/Dialog.tsx
The error thrown is 'Dialog' context provider not yet initialized.
, which shouldn't be the case, since Layout wraps the DialogProvider
at the top of the tree, is it because my Welcome
component is being created first? How do I fix this?
Thank you!8 Replies
Could be because you're destructuring props
ooooh
hmm
this still isn't working
hard to tell what the issue is, but why not initialize the dialog context outside the
Context
component?
The default value isn't really necessaryI think I got it
my
Layout
was wonky
that's what ended up fixing it
I don't think that's going to work log-term though
because I'm not forwarding my props to the componentyeah seems like a weird solution
is there a reason for Layout to take a page?
just a different style, I'm still figuring out what I want my design patterns to be here
gotcha
but if that's where this design style takes me
I think I'll pass on passing it as props
hmmmm