mirror of
https://github.com/TanStack/router.git
synced 2026-11-16 19:38:07 +00:00
* RouterType * RouteApiType * RouteType * ParsedLocation linking * linking RouterType, RouteType, and RouteApiType * reduce SearchParamOptionsType and PathParamOptionsType into ToOptionsType * useLinkProps * forgot to remove that * more
1.1 KiB
1.1 KiB
| id | title |
|---|---|
| RouterClass | Router Class |
🚧 The
Routerclass is deprecated and will be removed in the next major version of TanStack Router. Please use thecreateRouterfunction instead. The constructor and methods associated with this class will be implemented on its functional counterpart in the next major release.
The Router class is used to instantiate a new router instance.
Router constructor
The Router constructor accepts a single argument: the options that will be used to configure the router instance.
Constructor options
- Type:
RouterOptions - Required
- The options that will be used to configure the router instance.
Constructor returns
- An instance of the
Router.
Examples
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} />
}