0
Fork 0
mirror of https://github.com/TanStack/router.git synced 2026-11-16 19:38:07 +00:00
router/docs/framework/react/api/router/RouterClass.md
Sean Cassiere b5eabe19f5
docs: native markdown relative hyperlinks (#1998)
* docs: reference docs

* docs: guides

* docs: top-level

* docs: missed the route-trees

* docs: fixing routing-concepts
2024-07-20 18:23:45 +12:00

960 B

id title
RouterClass Router Class

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.

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

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} />
}