Caution
This class has been deprecated and will be removed in the next major version of TanStack Router. Please use the createRouter function instead.
The Router class is used to instantiate a new router instance.
The Router constructor accepts a single argument: the options that will be used to configure the router instance.
import { Router, RouterProvider } from '@tanstack/react-router'
import { routeTree } from './routeTree.gen'
const router = new Router({
routeTree,
defaultPreload: 'intent',
})
export default function App() {
return <RouterProvider router={router} />
}