SolidJSS
SolidJSโ€ข3y agoโ€ข
3 replies
Bersaelor

How to call for server-side-data in the `root.tsx` of solid-start`

Since I want to wrap my entire site in <ClientOnly> in the root.tsx, I can't use useRouteData as that is only supposed to be used under the
/routes
path.

So basically
[root.tsx]
    const serverData = createServerData( params.id );
   

    return <Html lang="en">
      <Head>
        <OGHeaders data={serverData} />
      </Head>
      <Body>
              <ClientOnly>
                <AuthContextProvider>
                  <AppContextProvider>
                    <Routes>
                      <FileRoutes />
                    </Routes>
                  </AppContextProvider>
                </AuthContextProvider>
              </ClientOnly>
      </Body>
    </Html>

?
Was this page helpful?