import React from 'react' import ReactDOM from 'react-dom/client' import { RouterProvider, createRouter } from '@tanstack/react-router' import { routeTree } from './routeTree.gen' import { AuthContextProvider, useAuth } from './auth' import './styles.css' // Set up a Router instance const router = createRouter({ routeTree, defaultPreload: 'intent', scrollRestoration: true, context: { auth: undefined!, // This will be set after we wrap the app in AuthContextProvider }, }) // Register things for typesafety declare module '@tanstack/react-router' { interface Register { router: typeof router } } function InnerApp() { const auth = useAuth() // If the provider is initially loading, do not render the router if (auth.isInitialLoading) { return (