-
-
Notifications
You must be signed in to change notification settings - Fork 574
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add API docs * Update config
- Loading branch information
Showing
22 changed files
with
473 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
id: Link | ||
title: Link | ||
--- | ||
|
||
```tsx | ||
|
||
|
||
``` | ||
|
||
**Options** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
id: MatchRoute | ||
title: MatchRoute | ||
--- | ||
|
||
```tsx | ||
|
||
``` | ||
|
||
**Options** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
id: Outlet | ||
title: Outlet | ||
--- | ||
|
||
```tsx | ||
import { Outlet } from '@tanstack/react-router' | ||
|
||
``` | ||
|
||
**Options** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
id: Prompt | ||
title: Prompt | ||
--- | ||
|
||
```tsx | ||
|
||
``` | ||
|
||
**Options** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
id: Route | ||
title: Route | ||
--- | ||
|
||
```tsx | ||
|
||
``` | ||
|
||
**Options** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
--- | ||
id: RouterProvider | ||
title: RouterProvider | ||
--- | ||
|
||
Use the `RouterProvider` component to connect and provide a `createReactRouter` to your application: | ||
|
||
```tsx | ||
import { RouterProvider, createReactRouter } from '@tanstack/react-router' | ||
|
||
const router = new createReactRouter() | ||
|
||
function App() { | ||
return <RouterProvider router={router}>...</RouterProvider> | ||
} | ||
``` | ||
|
||
**Options** | ||
- `router: Router` | ||
- **Required** | ||
- the `createReactRouter` instance to provide | ||
- `history?: BrowserHistory | MemoryHistory | HashHistory` | ||
- **Optional** | ||
- `stringifySearch?: SearchSerializer` | ||
- **Optional** | ||
- `parseSearch?: SearchParser` | ||
- **Optional** | ||
- `filterRoutes?: FilterRoutesFn` | ||
- **Optional** | ||
- `defaultPreload?: false | 'intent'` | ||
- **Optional** | ||
- `defaultPreloadMaxAge?: number` | ||
- **Optional** | ||
- `defaultPreloadGcMaxAge?: number` | ||
- **Optional** | ||
- `defaultPreloadDelay?: number` | ||
- **Optional** | ||
- `defaultComponent?: GetFrameworkGeneric<'Component'>` | ||
- **Optional** | ||
- `defaultErrorComponent?: GetFrameworkGeneric<'ErrorComponent'>` | ||
- **Optional** | ||
- `defaultPendingComponent?: GetFrameworkGeneric<'Component'>` | ||
- **Optional** | ||
- `defaultLoaderMaxAge?: number` | ||
- **Optional** | ||
- `defaultLoaderGcMaxAge?: number` | ||
- **Optional** | ||
- `caseSensitive?: boolean` | ||
- **Optional** | ||
- `routeConfig?: TRouteConfig` | ||
- **Optional** | ||
- `basepath?: string` | ||
- **Optional** | ||
- `useServerData?: boolean` | ||
- **Optional** | ||
- `createRouter?: (router: Router<any, any, any>) => void` | ||
- **Optional** | ||
- `createRoute?: (opts: { route: AnyRoute, router: Router<any, any, any> }) => void` | ||
- **Optional** | ||
- `context?: TRouterContext` | ||
- **Optional** | ||
- `loadComponent?: (component: GetFrameworkGeneric<'Component'>) => Promise<GetFrameworkGeneric<'Component'>` | ||
- **Optional** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
id: createReactRouter | ||
title: createReactRouter | ||
--- | ||
|
||
```tsx | ||
import { createReactRouter } from '@tanstack/react-router' | ||
|
||
const router = createReactRouter({ | ||
|
||
}) | ||
``` | ||
|
||
**Options** | ||
- `options: RouterOptions<TRouteConfig, TRouterContext>` | ||
- **Required** | ||
|
||
**Returns** | ||
- `router: Router<TRouteConfig, TAllRouteInfo, TRouterContext>` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
id: createRouteConfig | ||
title: createRouteConfig | ||
--- | ||
|
||
```tsx | ||
import { createRouteConfig } from '@tanstack/react-router' | ||
|
||
const router = createRouteConfig() | ||
``` | ||
|
||
**Options** | ||
- `options: RouterOptions<TRouteConfig, TRouterContext>` | ||
- **Required** | ||
|
||
**Returns** | ||
- `router: Router<TRouteConfig, TAllRouteInfo, TRouterContext>` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
id: lazy | ||
title: lazy | ||
--- | ||
|
||
```tsx | ||
import { lazy } from '@tanstack/react-router' | ||
|
||
export const expensiveRoute = rootRoute.createRoute({ | ||
path: 'expensive', | ||
component: lazy(() => import('./Expensive')), | ||
}) | ||
``` | ||
|
||
**Options** | ||
- `importer: () => Promise<{ default: SyncRouteComponent }>` | ||
- **Required** | ||
|
||
**Returns** | ||
- `element: RouteComponent` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
id: useAction | ||
title: useAction | ||
--- | ||
|
||
```tsx | ||
const action = useAction({ | ||
from | ||
}) | ||
``` | ||
|
||
**Options** | ||
- `from: TFrom` | ||
- **Required** | ||
|
||
**Returns** | ||
- `action: Action<TFromRoute['actionPayload'], TFromRoute['actionResponse']>` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
id: useLinkProps | ||
title: useLinkProps | ||
--- | ||
|
||
```tsx | ||
const linkProps = useLinkProps(options) | ||
``` | ||
|
||
**Options** | ||
|
||
**Returns** | ||
- `linkProps: React.AnchorHTMLAttributes<HTMLAnchorElement>` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
id: useLoaderData | ||
title: useLoaderData | ||
--- | ||
|
||
```tsx | ||
const data = useLoaderData({ | ||
from, | ||
strict, | ||
select | ||
}) | ||
``` | ||
|
||
**Options** | ||
- `from: TFrom` | ||
- **Required** | ||
- `strict?: TStrict` | ||
- **Optional** | ||
- `select?: (loaderData: TLoaderData) => TSelected` | ||
- **Optional** | ||
|
||
**Returns** | ||
- `data: TStrict extends true ? TSelected : TSelected | undefined` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
id: useMatch | ||
title: useMatch | ||
--- | ||
|
||
```tsx | ||
const match = useMatch({ | ||
from, | ||
strict | ||
}) | ||
``` | ||
|
||
**Options** | ||
- `from: TFrom` | ||
- **Required** | ||
- `strict?: TStrict` | ||
- **Optional** | ||
|
||
**Returns** | ||
- `match: TStrict extends true ? TRouteMatch : TRouteMatch | undefined` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
id: useMatchRoute | ||
title: useMatchRoute | ||
--- | ||
|
||
```tsx | ||
const matchRoute = useMatchRoute() | ||
``` | ||
|
||
**Options** | ||
|
||
**Returns** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
id: useNavigate | ||
title: useNavigate | ||
--- | ||
|
||
```tsx | ||
const navigate = useNavigate({ | ||
from | ||
}) | ||
``` | ||
|
||
**Options** | ||
- `from?: TDefaultFrom` | ||
- **Optional** | ||
|
||
**Returns** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
id: useParams | ||
title: useParams | ||
--- | ||
|
||
```tsx | ||
const params = useParams({ | ||
from, | ||
select | ||
}) | ||
``` | ||
|
||
**Options** | ||
- `from: TFrom` | ||
- **Required** | ||
- `select?: (search: TDefaultSelected) => TSelected` | ||
- **Optional** | ||
|
||
**Returns** | ||
- `params: TSelected` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
id: usePrompt | ||
title: usePrompt | ||
--- | ||
|
||
```tsx | ||
usePrompt(message, when) | ||
``` | ||
|
||
**Options** | ||
- `message: string` | ||
- **Required** | ||
- `when: boolean | any` | ||
- **Required** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
id: useRoute | ||
title: useRoute | ||
--- | ||
|
||
```tsx | ||
const route = useRoute(routeId) | ||
``` | ||
|
||
**Options** | ||
- `routeId: TId` | ||
- **Required** | ||
|
||
**Returns** | ||
- `route: Route<RegisteredAllRouteInfo, RegisteredAllRouteInfo['routeInfoById'][TId]>` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
id: useRouter | ||
title: useRouter | ||
--- | ||
|
||
```tsx | ||
const router = useRouter() | ||
``` | ||
|
||
**Returns** | ||
- `router: RegisteredRouter` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
id: useRouterStore | ||
title: useRouterStore | ||
--- | ||
|
||
```tsx | ||
const routerStore = useRouterStore({ | ||
selector | ||
}) | ||
``` | ||
|
||
**Options** | ||
- `selector?: (state: Router['store']) => T` | ||
- **Optional** | ||
|
||
**Returns** | ||
- `routerStore?` | ||
- **Optional** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
id: useSearch | ||
title: useSearch | ||
--- | ||
|
||
```tsx | ||
const search = useSearch({ | ||
from, | ||
strict, | ||
select | ||
}) | ||
``` | ||
|
||
**Options** | ||
- `from: TFrom` | ||
- **Required** | ||
- `strict?: TStrict` | ||
- **Optional** | ||
- `select?: (search: TSearch) => TSelected` | ||
- **Optional** | ||
|
||
**Returns** | ||
- `search: TSelected | undefined` |
Oops, something went wrong.