Open History to see the last commit
1import { createRouter } from '@tanstack/react-router'
2import { setupRouterSsrQueryIntegration } from '@tanstack/react-router-ssr-query'
3import * as TanstackQuery from './integrations/tanstack-query/root-provider'
4β
5// Import the generated route tree
6import { routeTree } from './routeTree.gen'
7β
8// Create a new router instance
9export const getRouter = () => {
10 const rqContext = TanstackQuery.getContext()
11β
12 const router = createRouter({
13 routeTree,
14 context: {
15 ...rqContext,
16 },
17β
18 defaultPreload: 'intent',
19 })
20β
21 setupRouterSsrQueryIntegration({ router, queryClient: rqContext.queryClient })
22β
23 return router
24}