mirror of
https://github.com/TanStack/router.git
synced 2026-11-16 19:38:07 +00:00
* docs: reference docs * docs: guides * docs: top-level * docs: missed the route-trees * docs: fixing routing-concepts
1.4 KiB
1.4 KiB
| id | title |
|---|---|
| NotFoundRouteClass | NotFoundRoute class |
Caution
This class has been deprecated and will be removed in the next major version of TanStack Router. Please use the
notFoundComponentroute option that is present during route configuration. See the Not Found Errors guide for more information.
The NotFoundRoute class extends the Route class and can be used to create a not found route instance. A not found route instance can be passed to the routerOptions.notFoundRoute option to configure a default not-found/404 route for every branch of the route tree.
Constructor options
The NotFoundRoute constructor accepts an object as its only argument.
- Type:
Omit<
RouteOptions,
| 'path'
| 'id'
| 'getParentRoute'
| 'caseSensitive'
| 'parseParams'
| 'stringifyParams'
>
- RouteOptions
- Required
- The options that will be used to configure the not found route instance.
Examples
import { NotFoundRoute, createRouter } from '@tanstack/react-router'
import { Route as rootRoute } from './routes/__root'
import { routeTree } from './routeTree.gen'
const notFoundRoute = new NotFoundRoute({
getParentRoute: () => rootRoute,
component: () => <div>Not found!!!</div>,
})
const router = createRouter({
routeTree,
notFoundRoute,
})
// ... other code