@@ -5,10 +5,11 @@ import {
55 Outlet ,
66 Scripts ,
77 createRootRoute ,
8- } from '@tanstack/react-router'
9- import { TanStackRouterDevtools } from '@tanstack/react-router-devtools'
10- import { createServerFn } from '@tanstack/react-start'
11- import * as React from 'react'
8+ } from '@tanstack/solid-router'
9+ import { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'
10+ import { createServerFn } from '@tanstack/solid-start'
11+ import { HydrationScript } from 'solid-js/web'
12+ import type * as Solid from 'solid-js'
1213import { DefaultCatchBoundary } from '~/components/DefaultCatchBoundary.js'
1314import { NotFound } from '~/components/NotFound.js'
1415import appCss from '~/styles/app.css?url'
@@ -39,7 +40,7 @@ export const Route = createRootRoute({
3940 head : ( ) => ( {
4041 meta : [
4142 {
42- charSet : 'utf-8' ,
43+ charset : 'utf-8' ,
4344 } ,
4445 {
4546 name : 'viewport' ,
@@ -93,20 +94,21 @@ function RootComponent() {
9394 )
9495}
9596
96- function RootDocument ( { children } : { children : React . ReactNode } ) {
97- const { user } = Route . useRouteContext ( )
97+ function RootDocument ( { children } : { children : Solid . JSX . Element } ) {
98+ const routeContext = Route . useRouteContext ( )
9899
99100 return (
100101 < html >
101102 < head >
102- < HeadContent />
103+ < HydrationScript />
103104 </ head >
104105 < body >
105- < div className = "p-2 flex gap-2 text-lg" >
106+ < HeadContent />
107+ < div class = "p-2 flex gap-2 text-lg" >
106108 < Link
107109 to = "/"
108110 activeProps = { {
109- className : 'font-bold' ,
111+ class : 'font-bold' ,
110112 } }
111113 activeOptions = { { exact : true } }
112114 >
@@ -115,15 +117,15 @@ function RootDocument({ children }: { children: React.ReactNode }) {
115117 < Link
116118 to = "/posts"
117119 activeProps = { {
118- className : 'font-bold' ,
120+ class : 'font-bold' ,
119121 } }
120122 >
121123 Posts
122124 </ Link >
123- < div className = "ml-auto" >
124- { user ? (
125+ < div class = "ml-auto" >
126+ { routeContext ( ) . user ? (
125127 < >
126- < span className = "mr-2" > { user . email } </ span >
128+ < span class = "mr-2" > { routeContext ( ) . user ? .email } </ span >
127129 < Link to = "/logout" > Logout</ Link >
128130 </ >
129131 ) : (
0 commit comments