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 ab02f3ebd3
docs: moving reference content out of the class files (#1633)
* RouterType

* RouteApiType

* RouteType

* ParsedLocation linking

* linking RouterType, RouteType, and RouteApiType

* reduce SearchParamOptionsType and PathParamOptionsType into ToOptionsType

* useLinkProps

* forgot to remove that

* more
2024-05-19 14:52:44 +12:00

1.1 KiB

id title
RouterClass Router Class

🚧 The Router class is deprecated and will be removed in the next major version of TanStack Router. Please use the createRouter function 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

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