@tanstack/react-router 1.139.14 → 1.140.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/llms/rules/api.d.ts +1 -1
- package/dist/llms/rules/api.js +136 -136
- package/dist/llms/rules/guide.d.ts +1 -1
- package/dist/llms/rules/guide.js +26 -26
- package/dist/llms/rules/installation.d.ts +1 -1
- package/dist/llms/rules/installation.js +7 -7
- package/dist/llms/rules/routing.d.ts +1 -1
- package/dist/llms/rules/routing.js +38 -38
- package/dist/llms/rules/setup-and-architecture.d.ts +1 -1
- package/dist/llms/rules/setup-and-architecture.js +5 -5
- package/package.json +4 -4
package/dist/llms/rules/api.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default `# ActiveLinkOptions type
|
|
2
2
|
|
|
3
|
-
The \`ActiveLinkOptions\` type extends the [\`LinkOptions\`](
|
|
3
|
+
The \`ActiveLinkOptions\` type extends the [\`LinkOptions\`](./LinkOptionsType.md) type and contains additional options that can be used to describe how a link should be styled when it is active.
|
|
4
4
|
|
|
5
5
|
\`\`\`tsx
|
|
6
6
|
type ActiveLinkOptions = LinkOptions & {
|
|
@@ -43,7 +43,7 @@ type AsyncRouteComponent<TProps> = SyncRouteComponent<TProps> & {
|
|
|
43
43
|
|
|
44
44
|
> [!CAUTION]
|
|
45
45
|
> This class has been deprecated and will be removed in the next major version of TanStack Router.
|
|
46
|
-
> Please use the [\`createFileRoute\`](
|
|
46
|
+
> Please use the [\`createFileRoute\`](./createFileRouteFunction.md) function instead.
|
|
47
47
|
|
|
48
48
|
The \`FileRoute\` class is a factory that can be used to create a file-based route instance. This route instance can then be used to automatically generate a route tree with the \`tsr generate\` and \`tsr watch\` commands.
|
|
49
49
|
|
|
@@ -72,13 +72,13 @@ The \`createRoute\` method is a method that can be used to configure the file ro
|
|
|
72
72
|
#### .createRoute options
|
|
73
73
|
|
|
74
74
|
- Type: \`Omit<RouteOptions, 'getParentRoute' | 'path' | 'id'>\`
|
|
75
|
-
- [\`RouteOptions\`](
|
|
75
|
+
- [\`RouteOptions\`](./RouteOptionsType.md)
|
|
76
76
|
- Optional
|
|
77
77
|
- The same options that are available to the \`Route\` class, but with the \`getParentRoute\`, \`path\`, and \`id\` options omitted since they are unnecessary for file-based routing.
|
|
78
78
|
|
|
79
79
|
#### .createRoute returns
|
|
80
80
|
|
|
81
|
-
A [\`Route\`](
|
|
81
|
+
A [\`Route\`](./RouteType.md) instance that can be used to configure the route to be inserted into the route-tree.
|
|
82
82
|
|
|
83
83
|
> ⚠️ Note: For \`tsr generate\` and \`tsr watch\` to work properly, the file route instance must be exported from the file using the \`Route\` identifier.
|
|
84
84
|
|
|
@@ -102,7 +102,7 @@ function IndexComponent() {
|
|
|
102
102
|
|
|
103
103
|
# LinkOptions type
|
|
104
104
|
|
|
105
|
-
The \`LinkOptions\` type extends the [\`NavigateOptions\`](
|
|
105
|
+
The \`LinkOptions\` type extends the [\`NavigateOptions\`](./NavigateOptionsType.md) type and contains additional options that can be used by TanStack Router when handling actual anchor element attributes.
|
|
106
106
|
|
|
107
107
|
\`\`\`tsx
|
|
108
108
|
type LinkOptions = NavigateOptions & {
|
|
@@ -135,7 +135,7 @@ The \`LinkOptions\` object accepts/contains the following properties:
|
|
|
135
135
|
- Type: \`false | 'intent' | 'viewport' | 'render'\`
|
|
136
136
|
- Optional
|
|
137
137
|
- If set, the link's preloading strategy will be set to this value.
|
|
138
|
-
- See the [Preloading guide](
|
|
138
|
+
- See the [Preloading guide](../../guide/preloading.md) for more information.
|
|
139
139
|
|
|
140
140
|
### \`preloadDelay\`
|
|
141
141
|
|
|
@@ -151,7 +151,7 @@ The \`LinkOptions\` object accepts/contains the following properties:
|
|
|
151
151
|
|
|
152
152
|
# LinkProps type
|
|
153
153
|
|
|
154
|
-
The \`LinkProps\` type extends the [\`ActiveLinkOptions\`](
|
|
154
|
+
The \`LinkProps\` type extends the [\`ActiveLinkOptions\`](./ActiveLinkOptionsType.md) and \`React.AnchorHTMLAttributes<HTMLAnchorElement>\` types and contains additional props specific to the \`Link\` component.
|
|
155
155
|
|
|
156
156
|
\`\`\`tsx
|
|
157
157
|
type LinkProps = ActiveLinkOptions &
|
|
@@ -164,7 +164,7 @@ type LinkProps = ActiveLinkOptions &
|
|
|
164
164
|
|
|
165
165
|
## LinkProps properties
|
|
166
166
|
|
|
167
|
-
- All of the props from [\`ActiveLinkOptions\`](
|
|
167
|
+
- All of the props from [\`ActiveLinkOptions\`](./ActiveLinkOptionsType.md)
|
|
168
168
|
- All of the props from \`React.AnchorHTMLAttributes<HTMLAnchorElement>\`
|
|
169
169
|
|
|
170
170
|
#### \`children\`
|
|
@@ -264,7 +264,7 @@ The \`NavigateOptions\` object accepts the following properties:
|
|
|
264
264
|
- Optional
|
|
265
265
|
- Defaults to \`false\`.
|
|
266
266
|
- If \`true\`, navigation will be called using \`document.startViewTransition()\`.
|
|
267
|
-
- If [\`ViewTransitionOptions\`](
|
|
267
|
+
- If [\`ViewTransitionOptions\`](./ViewTransitionOptionsType.md), route navigations will be called using \`document.startViewTransition({update, types})\` where \`types\` will determine the strings array passed with \`ViewTransitionOptions["types"]\`. If the browser does not support viewTransition types, the navigation will fall back to normal \`document.startTransition()\`, same as if \`true\` was passed.
|
|
268
268
|
- If the browser does not support this api, this option will be ignored.
|
|
269
269
|
- See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Document/startViewTransition) for more information on how this function works.
|
|
270
270
|
- See [Google](https://developer.chrome.com/docs/web-platform/view-transitions/same-document#view-transition-types) for more information on viewTransition types
|
|
@@ -289,7 +289,7 @@ The \`NavigateOptions\` object accepts the following properties:
|
|
|
289
289
|
- Optional
|
|
290
290
|
- This can be used instead of \`to\` to navigate to a fully built href, e.g. pointing to an external target.
|
|
291
291
|
|
|
292
|
-
- [\`ToOptions\`](
|
|
292
|
+
- [\`ToOptions\`](./ToOptionsType.md)
|
|
293
293
|
|
|
294
294
|
# NotFoundError
|
|
295
295
|
|
|
@@ -344,7 +344,7 @@ The \`NotFoundError\` object accepts/contains the following properties:
|
|
|
344
344
|
> [!CAUTION]
|
|
345
345
|
> This class has been deprecated and will be removed in the next major version of TanStack Router.
|
|
346
346
|
> Please use the \`notFoundComponent\` route option that is present during route configuration.
|
|
347
|
-
> See the [Not Found Errors guide](
|
|
347
|
+
> See the [Not Found Errors guide](../../guide/not-found-errors.md) for more information.
|
|
348
348
|
|
|
349
349
|
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.
|
|
350
350
|
|
|
@@ -366,7 +366,7 @@ Omit<
|
|
|
366
366
|
>
|
|
367
367
|
\`\`\`
|
|
368
368
|
|
|
369
|
-
- [RouteOptions](
|
|
369
|
+
- [RouteOptions](./RouteOptionsType.md)
|
|
370
370
|
- Required
|
|
371
371
|
- The options that will be used to configure the not found route instance.
|
|
372
372
|
|
|
@@ -431,7 +431,7 @@ export type Redirect = {
|
|
|
431
431
|
} & NavigateOptions
|
|
432
432
|
\`\`\`
|
|
433
433
|
|
|
434
|
-
- [\`NavigateOptions\`](
|
|
434
|
+
- [\`NavigateOptions\`](./NavigateOptionsType.md)
|
|
435
435
|
|
|
436
436
|
## Redirect properties
|
|
437
437
|
|
|
@@ -494,7 +494,7 @@ declare module '@tanstack/react-router' {
|
|
|
494
494
|
|
|
495
495
|
> [!CAUTION]
|
|
496
496
|
> This class has been deprecated and will be removed in the next major version of TanStack Router.
|
|
497
|
-
> Please use the [\`createRootRoute\`](
|
|
497
|
+
> Please use the [\`createRootRoute\`](./createRootRouteFunction.md) function instead.
|
|
498
498
|
|
|
499
499
|
The \`RootRoute\` class extends the \`Route\` class and can be used to create a root route instance. A root route instance can then be used to create a route tree.
|
|
500
500
|
|
|
@@ -520,12 +520,12 @@ Omit<
|
|
|
520
520
|
>
|
|
521
521
|
\`\`\`
|
|
522
522
|
|
|
523
|
-
- [\`RouteOptions\`](
|
|
523
|
+
- [\`RouteOptions\`](./RouteOptionsType.md)
|
|
524
524
|
- Optional
|
|
525
525
|
|
|
526
526
|
## Constructor returns
|
|
527
527
|
|
|
528
|
-
A new [\`Route\`](
|
|
528
|
+
A new [\`Route\`](./RouteType.md) instance.
|
|
529
529
|
|
|
530
530
|
## Examples
|
|
531
531
|
|
|
@@ -550,7 +550,7 @@ const router = createRouter({
|
|
|
550
550
|
|
|
551
551
|
> [!CAUTION]
|
|
552
552
|
> This class has been deprecated and will be removed in the next major version of TanStack Router.
|
|
553
|
-
> Please use the [\`getRouteApi\`](
|
|
553
|
+
> Please use the [\`getRouteApi\`](./getRouteApiFunction.md) function instead.
|
|
554
554
|
|
|
555
555
|
The \`RouteApi\` class provides type-safe version of common hooks like \`useParams\`, \`useSearch\`, \`useRouteContext\`, \`useNavigate\`, \`useLoaderData\`, and \`useLoaderDeps\` that are pre-bound to a specific route ID and corresponding registered route types.
|
|
556
556
|
|
|
@@ -566,7 +566,7 @@ The \`RouteApi\` constructor accepts a single argument: the \`options\` that wil
|
|
|
566
566
|
|
|
567
567
|
## Constructor returns
|
|
568
568
|
|
|
569
|
-
- An instance of the [\`RouteApi\`](
|
|
569
|
+
- An instance of the [\`RouteApi\`](./RouteApiType.md) that is pre-bound to the route ID that it was called with.
|
|
570
570
|
|
|
571
571
|
## Examples
|
|
572
572
|
|
|
@@ -597,7 +597,7 @@ The \`RouteApi\` has the following properties and methods:
|
|
|
597
597
|
}): TSelected
|
|
598
598
|
\`\`\`
|
|
599
599
|
|
|
600
|
-
- A type-safe version of the [\`useMatch\`](
|
|
600
|
+
- A type-safe version of the [\`useMatch\`](./useMatchHook.md) hook that is pre-bound to the route ID that the \`RouteApi\` instance was created with.
|
|
601
601
|
- Options
|
|
602
602
|
- \`opts.select\`
|
|
603
603
|
- Optional
|
|
@@ -607,7 +607,7 @@ The \`RouteApi\` has the following properties and methods:
|
|
|
607
607
|
- Optional
|
|
608
608
|
- \`boolean\`
|
|
609
609
|
- Configures whether structural sharing is enabled for the value returned by \`select\`.
|
|
610
|
-
- See the [Render Optimizations guide](
|
|
610
|
+
- See the [Render Optimizations guide](../../guide/render-optimizations.md) for more information.
|
|
611
611
|
- Returns
|
|
612
612
|
- If a \`select\` function is provided, the return value of the \`select\` function.
|
|
613
613
|
- If no \`select\` function is provided, the \`RouteMatch\` object or a loosened version of the \`RouteMatch\` object if \`opts.strict\` is \`false\`.
|
|
@@ -620,7 +620,7 @@ The \`RouteApi\` has the following properties and methods:
|
|
|
620
620
|
}): TSelected
|
|
621
621
|
\`\`\`
|
|
622
622
|
|
|
623
|
-
- A type-safe version of the [\`useRouteContext\`](
|
|
623
|
+
- A type-safe version of the [\`useRouteContext\`](./useRouteContextHook.md) hook that is pre-bound to the route ID that the \`RouteApi\` instance was created with.
|
|
624
624
|
- Options
|
|
625
625
|
- \`opts.select\`
|
|
626
626
|
- Optional
|
|
@@ -638,7 +638,7 @@ The \`RouteApi\` has the following properties and methods:
|
|
|
638
638
|
}): TSelected
|
|
639
639
|
\`\`\`
|
|
640
640
|
|
|
641
|
-
- A type-safe version of the [\`useSearch\`](
|
|
641
|
+
- A type-safe version of the [\`useSearch\`](./useSearchHook.md) hook that is pre-bound to the route ID that the \`RouteApi\` instance was created with.
|
|
642
642
|
- Options
|
|
643
643
|
- \`opts.select\`
|
|
644
644
|
- Optional
|
|
@@ -648,7 +648,7 @@ The \`RouteApi\` has the following properties and methods:
|
|
|
648
648
|
- Optional
|
|
649
649
|
- \`boolean\`
|
|
650
650
|
- Configures whether structural sharing is enabled for the value returned by \`select\`.
|
|
651
|
-
- See the [Render Optimizations guide](
|
|
651
|
+
- See the [Render Optimizations guide](../../guide/render-optimizations.md) for more information.
|
|
652
652
|
- Returns
|
|
653
653
|
- If a \`select\` function is provided, the return value of the \`select\` function.
|
|
654
654
|
- If no \`select\` function is provided, the \`TFullSearchSchema\` object or a loosened version of the \`TFullSearchSchema\` object if \`opts.strict\` is \`false\`.
|
|
@@ -661,7 +661,7 @@ The \`RouteApi\` has the following properties and methods:
|
|
|
661
661
|
}): TSelected
|
|
662
662
|
\`\`\`
|
|
663
663
|
|
|
664
|
-
- A type-safe version of the [\`useParams\`](
|
|
664
|
+
- A type-safe version of the [\`useParams\`](./useParamsHook.md) hook that is pre-bound to the route ID that the \`RouteApi\` instance was created with.
|
|
665
665
|
- Options
|
|
666
666
|
- \`opts.select\`
|
|
667
667
|
- Optional
|
|
@@ -671,7 +671,7 @@ The \`RouteApi\` has the following properties and methods:
|
|
|
671
671
|
- Optional
|
|
672
672
|
- \`boolean\`
|
|
673
673
|
- Configures whether structural sharing is enabled for the value returned by \`select\`.
|
|
674
|
-
- See the [Render Optimizations guide](
|
|
674
|
+
- See the [Render Optimizations guide](../../guide/render-optimizations.md) for more information.
|
|
675
675
|
- Returns
|
|
676
676
|
- If a \`select\` function is provided, the return value of the \`select\` function.
|
|
677
677
|
- If no \`select\` function is provided, the \`TAllParams\` object or a loosened version of the \`TAllParams\` object if \`opts.strict\` is \`false\`.
|
|
@@ -684,7 +684,7 @@ The \`RouteApi\` has the following properties and methods:
|
|
|
684
684
|
}): TSelected
|
|
685
685
|
\`\`\`
|
|
686
686
|
|
|
687
|
-
- A type-safe version of the [\`useLoaderData\`](
|
|
687
|
+
- A type-safe version of the [\`useLoaderData\`](./useLoaderDataHook.md) hook that is pre-bound to the route ID that the \`RouteApi\` instance was created with.
|
|
688
688
|
- Options
|
|
689
689
|
- \`opts.select\`
|
|
690
690
|
- Optional
|
|
@@ -694,7 +694,7 @@ The \`RouteApi\` has the following properties and methods:
|
|
|
694
694
|
- Optional
|
|
695
695
|
- \`boolean\`
|
|
696
696
|
- Configures whether structural sharing is enabled for the value returned by \`select\`.
|
|
697
|
-
- See the [Render Optimizations guide](
|
|
697
|
+
- See the [Render Optimizations guide](../../guide/render-optimizations.md) for more information.
|
|
698
698
|
- Returns
|
|
699
699
|
- If a \`select\` function is provided, the return value of the \`select\` function.
|
|
700
700
|
- If no \`select\` function is provided, the \`TLoaderData\` object or a loosened version of the \`TLoaderData\` object if \`opts.strict\` is \`false\`.
|
|
@@ -707,7 +707,7 @@ The \`RouteApi\` has the following properties and methods:
|
|
|
707
707
|
}): TSelected
|
|
708
708
|
\`\`\`
|
|
709
709
|
|
|
710
|
-
- A type-safe version of the [\`useLoaderDeps\`](
|
|
710
|
+
- A type-safe version of the [\`useLoaderDeps\`](./useLoaderDepsHook.md) hook that is pre-bound to the route ID that the \`RouteApi\` instance was created with.
|
|
711
711
|
- Options
|
|
712
712
|
- \`opts.select\`
|
|
713
713
|
- Optional
|
|
@@ -717,7 +717,7 @@ The \`RouteApi\` has the following properties and methods:
|
|
|
717
717
|
- Optional
|
|
718
718
|
- \`boolean\`
|
|
719
719
|
- Configures whether structural sharing is enabled for the value returned by \`select\`.
|
|
720
|
-
- See the [Render Optimizations guide](
|
|
720
|
+
- See the [Render Optimizations guide](../../guide/render-optimizations.md) for more information.
|
|
721
721
|
- Returns
|
|
722
722
|
- If a \`select\` function is provided, the return value of the \`select\` function.
|
|
723
723
|
- If no \`select\` function is provided, the \`TLoaderDeps\` object.
|
|
@@ -728,13 +728,13 @@ The \`RouteApi\` has the following properties and methods:
|
|
|
728
728
|
useNavigate(): // navigate function
|
|
729
729
|
\`\`\`
|
|
730
730
|
|
|
731
|
-
- A type-safe version of [\`useNavigate\`](
|
|
731
|
+
- A type-safe version of [\`useNavigate\`](./useNavigateHook.md) that is pre-bound to the route ID that the \`RouteApi\` instance was created with.
|
|
732
732
|
|
|
733
733
|
# Route class
|
|
734
734
|
|
|
735
735
|
> [!CAUTION]
|
|
736
736
|
> This class has been deprecated and will be removed in the next major version of TanStack Router.
|
|
737
|
-
> Please use the [\`createRoute\`](
|
|
737
|
+
> Please use the [\`createRoute\`](./createRouteFunction.md) function instead.
|
|
738
738
|
|
|
739
739
|
The \`Route\` class implements the \`RouteApi\` class and can be used to create route instances. A route instance can then be used to create a route tree.
|
|
740
740
|
|
|
@@ -744,13 +744,13 @@ The \`Route\` constructor accepts an object as its only argument.
|
|
|
744
744
|
|
|
745
745
|
### Constructor options
|
|
746
746
|
|
|
747
|
-
- Type: [\`RouteOptions\`](
|
|
747
|
+
- Type: [\`RouteOptions\`](./RouteOptionsType.md)
|
|
748
748
|
- Required
|
|
749
749
|
- The options that will be used to configure the route instance
|
|
750
750
|
|
|
751
751
|
### Constructor returns
|
|
752
752
|
|
|
753
|
-
A new [\`Route\`](
|
|
753
|
+
A new [\`Route\`](./RouteType.md) instance.
|
|
754
754
|
|
|
755
755
|
## Examples
|
|
756
756
|
|
|
@@ -775,7 +775,7 @@ function IndexComponent() {
|
|
|
775
775
|
|
|
776
776
|
# RouteMask type
|
|
777
777
|
|
|
778
|
-
The \`RouteMask\` type extends the [\`ToOptions\`](
|
|
778
|
+
The \`RouteMask\` type extends the [\`ToOptions\`](./ToOptionsType.md) type and has other the necessary properties to create a route mask.
|
|
779
779
|
|
|
780
780
|
## RouteMask properties
|
|
781
781
|
|
|
@@ -783,7 +783,7 @@ The \`RouteMask\` type accepts an object with the following properties:
|
|
|
783
783
|
|
|
784
784
|
### \`...ToOptions\`
|
|
785
785
|
|
|
786
|
-
- Type: [\`ToOptions\`](
|
|
786
|
+
- Type: [\`ToOptions\`](./ToOptionsType.md)
|
|
787
787
|
- Required
|
|
788
788
|
- The options that will be used to configure the route mask
|
|
789
789
|
|
|
@@ -934,13 +934,13 @@ type beforeLoad = (
|
|
|
934
934
|
\`\`\`
|
|
935
935
|
|
|
936
936
|
- Optional
|
|
937
|
-
- [\`ParsedLocation\`](
|
|
937
|
+
- [\`ParsedLocation\`](./ParsedLocationType.md)
|
|
938
938
|
- This async function is called before a route is loaded. If an error is thrown here, the route's loader will not be called and the route will not render. If thrown during a navigation, the navigation will be canceled and the error will be passed to the \`onError\` function. If thrown during a preload event, the error will be logged to the console and the preload will fail.
|
|
939
939
|
- If this function returns a promise, the route will be put into a pending state and cause rendering to suspend until the promise resolves. If this route's pendingMs threshold is reached, the \`pendingComponent\` will be shown until it resolves. If the promise rejects, the route will be put into an error state and the error will be thrown during render.
|
|
940
940
|
- If this function returns a \`TRouteContext\` object, that object will be merged into the route's context and be made available in the \`loader\` and other related route components/methods.
|
|
941
941
|
- It's common to use this function to check if a user is authenticated and redirect them to a login page if they are not. To do this, you can either return or throw a \`redirect\` object from this function.
|
|
942
942
|
|
|
943
|
-
> 🚧 \`opts.navigate\` has been deprecated and will be removed in the next major release. Use \`throw redirect({ to: '/somewhere' })\` instead. Read more about the \`redirect\` function [here](
|
|
943
|
+
> 🚧 \`opts.navigate\` has been deprecated and will be removed in the next major release. Use \`throw redirect({ to: '/somewhere' })\` instead. Read more about the \`redirect\` function [here](./redirectFunction.md).
|
|
944
944
|
|
|
945
945
|
### \`loader\` method
|
|
946
946
|
|
|
@@ -964,13 +964,13 @@ type loader = (
|
|
|
964
964
|
\`\`\`
|
|
965
965
|
|
|
966
966
|
- Optional
|
|
967
|
-
- [\`ParsedLocation\`](
|
|
967
|
+
- [\`ParsedLocation\`](./ParsedLocationType.md)
|
|
968
968
|
- This async function is called when a route is matched and passed the route's match object. If an error is thrown here, the route will be put into an error state and the error will be thrown during render. If thrown during a navigation, the navigation will be canceled and the error will be passed to the \`onError\` function. If thrown during a preload event, the error will be logged to the console and the preload will fail.
|
|
969
969
|
- If this function returns a promise, the route will be put into a pending state and cause rendering to suspend until the promise resolves. If this route's pendingMs threshold is reached, the \`pendingComponent\` will be shown until it resolves. If the promise rejects, the route will be put into an error state and the error will be thrown during render.
|
|
970
970
|
- If this function returns a \`TLoaderData\` object, that object will be stored on the route match until the route match is no longer active. It can be accessed using the \`useLoaderData\` hook in any component that is a child of the route match before another \`<Outlet />\` is rendered.
|
|
971
971
|
- Deps must be returned by your \`loaderDeps\` function in order to appear.
|
|
972
972
|
|
|
973
|
-
> 🚧 \`opts.navigate\` has been deprecated and will be removed in the next major release. Use \`throw redirect({ to: '/somewhere' })\` instead. Read more about the \`redirect\` function [here](
|
|
973
|
+
> 🚧 \`opts.navigate\` has been deprecated and will be removed in the next major release. Use \`throw redirect({ to: '/somewhere' })\` instead. Read more about the \`redirect\` function [here](./redirectFunction.md).
|
|
974
974
|
|
|
975
975
|
### \`loaderDeps\` method
|
|
976
976
|
|
|
@@ -1068,7 +1068,7 @@ type loaderDeps = (opts: { search: TFullSearchSchema }) => Record<string, any>
|
|
|
1068
1068
|
- Type: \`(error: any) => void\`
|
|
1069
1069
|
- Optional
|
|
1070
1070
|
- A function that will be called when an error is thrown during a navigation or preload event.
|
|
1071
|
-
- If this function throws a [\`redirect\`](
|
|
1071
|
+
- If this function throws a [\`redirect\`](./redirectFunction.md), then the router will process and apply the redirect immediately.
|
|
1072
1072
|
|
|
1073
1073
|
### \`onEnter\` property
|
|
1074
1074
|
|
|
@@ -1219,13 +1219,13 @@ An instance of the \`Route\` has the following properties and methods:
|
|
|
1219
1219
|
|
|
1220
1220
|
### ...\`RouteApi\` methods
|
|
1221
1221
|
|
|
1222
|
-
- All of the methods from [\`RouteApi\`](
|
|
1222
|
+
- All of the methods from [\`RouteApi\`](./RouteApiType.md) are available.
|
|
1223
1223
|
|
|
1224
1224
|
# Router Class
|
|
1225
1225
|
|
|
1226
1226
|
> [!CAUTION]
|
|
1227
1227
|
> This class has been deprecated and will be removed in the next major version of TanStack Router.
|
|
1228
|
-
> Please use the [\`createRouter\`](
|
|
1228
|
+
> Please use the [\`createRouter\`](./createRouterFunction.md) function instead.
|
|
1229
1229
|
|
|
1230
1230
|
The \`Router\` class is used to instantiate a new router instance.
|
|
1231
1231
|
|
|
@@ -1235,13 +1235,13 @@ The \`Router\` constructor accepts a single argument: the \`options\` that will
|
|
|
1235
1235
|
|
|
1236
1236
|
### Constructor options
|
|
1237
1237
|
|
|
1238
|
-
- Type: [\`RouterOptions\`](
|
|
1238
|
+
- Type: [\`RouterOptions\`](./RouterOptionsType.md)
|
|
1239
1239
|
- Required
|
|
1240
1240
|
- The options that will be used to configure the router instance.
|
|
1241
1241
|
|
|
1242
1242
|
### Constructor returns
|
|
1243
1243
|
|
|
1244
|
-
- An instance of the [\`Router\`](
|
|
1244
|
+
- An instance of the [\`Router\`](./RouterType.md).
|
|
1245
1245
|
|
|
1246
1246
|
## Examples
|
|
1247
1247
|
|
|
@@ -1324,12 +1324,12 @@ Once an event is emitted, the following properties will be present on the event
|
|
|
1324
1324
|
|
|
1325
1325
|
### \`fromLocation\` property
|
|
1326
1326
|
|
|
1327
|
-
- Type: [\`ParsedLocation\`](
|
|
1327
|
+
- Type: [\`ParsedLocation\`](./ParsedLocationType.md)
|
|
1328
1328
|
- The location that the router is transitioning from.
|
|
1329
1329
|
|
|
1330
1330
|
### \`toLocation\` property
|
|
1331
1331
|
|
|
1332
|
-
- Type: [\`ParsedLocation\`](
|
|
1332
|
+
- Type: [\`ParsedLocation\`](./ParsedLocationType.md)
|
|
1333
1333
|
- The location that the router is transitioning to.
|
|
1334
1334
|
|
|
1335
1335
|
### \`pathChanged\` property
|
|
@@ -1503,7 +1503,7 @@ The \`RouterOptions\` type accepts an object with the following properties and m
|
|
|
1503
1503
|
- Type: \`boolean | ViewTransitionOptions\`
|
|
1504
1504
|
- Optional
|
|
1505
1505
|
- If \`true\`, route navigations will be called using \`document.startViewTransition()\`.
|
|
1506
|
-
- If [\`ViewTransitionOptions\`](
|
|
1506
|
+
- If [\`ViewTransitionOptions\`](./ViewTransitionOptionsType.md), route navigations will be called using \`document.startViewTransition({update, types})\`
|
|
1507
1507
|
where \`types\` will be the strings array passed with \`ViewTransitionOptions["types"]\`. If the browser does not support viewTransition types,
|
|
1508
1508
|
the navigation will fall back to normal \`document.startTransition()\`, same as if \`true\` was passed.
|
|
1509
1509
|
- If the browser does not support this api, this option will be ignored.
|
|
@@ -1536,7 +1536,7 @@ The \`RouterOptions\` type accepts an object with the following properties and m
|
|
|
1536
1536
|
### \`context\` property
|
|
1537
1537
|
|
|
1538
1538
|
- Type: \`any\`
|
|
1539
|
-
- Optional or required if the root route was created with [\`createRootRouteWithContext()\`](
|
|
1539
|
+
- Optional or required if the root route was created with [\`createRootRouteWithContext()\`](./createRootRouteWithContextFunction.md).
|
|
1540
1540
|
- The root context that will be provided to all routes in the route tree. This can be used to provide a context to all routes in the tree without having to provide it to each route individually.
|
|
1541
1541
|
|
|
1542
1542
|
### \`dehydrate\` method
|
|
@@ -1613,7 +1613,7 @@ const router = createRouter({
|
|
|
1613
1613
|
- Type: \`'root' | 'fuzzy'\`
|
|
1614
1614
|
- Optional
|
|
1615
1615
|
- Defaults to \`'fuzzy'\`
|
|
1616
|
-
- This property controls how TanStack Router will handle scenarios where it cannot find a route to match the current location. See the [Not Found Errors guide](
|
|
1616
|
+
- This property controls how TanStack Router will handle scenarios where it cannot find a route to match the current location. See the [Not Found Errors guide](../../guide/not-found-errors.md) for more information.
|
|
1617
1617
|
|
|
1618
1618
|
### \`notFoundRoute\` property
|
|
1619
1619
|
|
|
@@ -1641,7 +1641,7 @@ const router = createRouter({
|
|
|
1641
1641
|
- Optional
|
|
1642
1642
|
- Defaults to \`false\`
|
|
1643
1643
|
- Configures whether structural sharing is enabled by default for fine-grained selectors.
|
|
1644
|
-
- See the [Render Optimizations guide](
|
|
1644
|
+
- See the [Render Optimizations guide](../../guide/render-optimizations.md) for more information.
|
|
1645
1645
|
|
|
1646
1646
|
### \`defaultRemountDeps\` property
|
|
1647
1647
|
|
|
@@ -1712,22 +1712,22 @@ The \`RouterState\` type contains all of the properties that are available on th
|
|
|
1712
1712
|
|
|
1713
1713
|
### \`matches\` property
|
|
1714
1714
|
|
|
1715
|
-
- Type: [\`Array<RouteMatch>\`](
|
|
1715
|
+
- Type: [\`Array<RouteMatch>\`](./RouteMatchType.md)
|
|
1716
1716
|
- An array of all of the route matches that have been resolved and are currently active.
|
|
1717
1717
|
|
|
1718
1718
|
### \`pendingMatches\` property
|
|
1719
1719
|
|
|
1720
|
-
- Type: [\`Array<RouteMatch>\`](
|
|
1720
|
+
- Type: [\`Array<RouteMatch>\`](./RouteMatchType.md)
|
|
1721
1721
|
- An array of all of the route matches that are currently pending.
|
|
1722
1722
|
|
|
1723
1723
|
### \`location\` property
|
|
1724
1724
|
|
|
1725
|
-
- Type: [\`ParsedLocation\`](
|
|
1725
|
+
- Type: [\`ParsedLocation\`](./ParsedLocationType.md)
|
|
1726
1726
|
- The latest location that the router has parsed from the browser history. This location may not be resolved and loaded yet.
|
|
1727
1727
|
|
|
1728
1728
|
### \`resolvedLocation\` property
|
|
1729
1729
|
|
|
1730
|
-
- Type: [\`ParsedLocation\`](
|
|
1730
|
+
- Type: [\`ParsedLocation\`](./ParsedLocationType.md)
|
|
1731
1731
|
- The location that the router has resolved and loaded.
|
|
1732
1732
|
|
|
1733
1733
|
# Router type
|
|
@@ -1745,15 +1745,15 @@ An instance of the \`Router\` has the following properties and methods:
|
|
|
1745
1745
|
|
|
1746
1746
|
### \`state\` property
|
|
1747
1747
|
|
|
1748
|
-
- Type: [\`RouterState\`](
|
|
1748
|
+
- Type: [\`RouterState\`](./RouterStateType.md)
|
|
1749
1749
|
- The current state of the router.
|
|
1750
1750
|
|
|
1751
|
-
> ⚠️⚠️⚠️ **\`router.state\` is always up to date, but NOT REACTIVE. If you use \`router.state\` in a component, the component will not re-render when the router state changes. To get a reactive version of the router state, use the [\`useRouterState\`](
|
|
1751
|
+
> ⚠️⚠️⚠️ **\`router.state\` is always up to date, but NOT REACTIVE. If you use \`router.state\` in a component, the component will not re-render when the router state changes. To get a reactive version of the router state, use the [\`useRouterState\`](./useRouterStateHook.md) hook.**
|
|
1752
1752
|
|
|
1753
1753
|
### \`.subscribe\` method
|
|
1754
1754
|
|
|
1755
1755
|
- Type: \`(eventType: TType, fn: ListenerFn<RouterEvents[TType]>) => (event: RouterEvent) => void\`
|
|
1756
|
-
- Subscribes to a [\`RouterEvent\`](
|
|
1756
|
+
- Subscribes to a [\`RouterEvent\`](./RouterEventsType.md).
|
|
1757
1757
|
- Returns a function that can be used to unsubscribe from the event.
|
|
1758
1758
|
- The callback provided to the returned function will be called with the event that was emitted.
|
|
1759
1759
|
|
|
@@ -1829,7 +1829,7 @@ Commits a new location object to the browser history.
|
|
|
1829
1829
|
\`\`\`
|
|
1830
1830
|
- Properties
|
|
1831
1831
|
- \`location\`
|
|
1832
|
-
- Type: [\`ParsedLocation\`](
|
|
1832
|
+
- Type: [\`ParsedLocation\`](./ParsedLocationType.md)
|
|
1833
1833
|
- Required
|
|
1834
1834
|
- The location to commit to the browser history.
|
|
1835
1835
|
- \`replace\`
|
|
@@ -1954,7 +1954,7 @@ Hydrates the router's critical state from a serializable object that was sent fr
|
|
|
1954
1954
|
|
|
1955
1955
|
# ToMaskOptions type
|
|
1956
1956
|
|
|
1957
|
-
The \`ToMaskOptions\` type extends the [\`ToOptions\`](
|
|
1957
|
+
The \`ToMaskOptions\` type extends the [\`ToOptions\`](./ToOptionsType.md) type and describes additional options available when using route masks.
|
|
1958
1958
|
|
|
1959
1959
|
\`\`\`tsx
|
|
1960
1960
|
type ToMaskOptions = ToOptions & {
|
|
@@ -1962,7 +1962,7 @@ type ToMaskOptions = ToOptions & {
|
|
|
1962
1962
|
}
|
|
1963
1963
|
\`\`\`
|
|
1964
1964
|
|
|
1965
|
-
- [\`ToOptions\`](
|
|
1965
|
+
- [\`ToOptions\`](./ToOptionsType.md)
|
|
1966
1966
|
|
|
1967
1967
|
# ToOptions type
|
|
1968
1968
|
|
|
@@ -1988,14 +1988,14 @@ type PathParamOptions = {
|
|
|
1988
1988
|
|
|
1989
1989
|
# UseMatchRouteOptions type
|
|
1990
1990
|
|
|
1991
|
-
The \`UseMatchRouteOptions\` type extends the [\`ToOptions\`](
|
|
1991
|
+
The \`UseMatchRouteOptions\` type extends the [\`ToOptions\`](./ToOptionsType.md) type and describes additional options available when using the [\`useMatchRoute\`](./useMatchRouteHook.md) hook.
|
|
1992
1992
|
|
|
1993
1993
|
\`\`\`tsx
|
|
1994
1994
|
export type UseMatchRouteOptions = ToOptions & MatchRouteOptions
|
|
1995
1995
|
\`\`\`
|
|
1996
1996
|
|
|
1997
|
-
- [\`ToOptions\`](
|
|
1998
|
-
- [\`MatchRouteOptions\`](
|
|
1997
|
+
- [\`ToOptions\`](./ToOptionsType.md)
|
|
1998
|
+
- [\`MatchRouteOptions\`](./MatchRouteOptionsType.md)
|
|
1999
1999
|
|
|
2000
2000
|
# ViewTransitionOptions type
|
|
2001
2001
|
|
|
@@ -2103,7 +2103,7 @@ The \`CatchBoundary\` component accepts the following props:
|
|
|
2103
2103
|
### \`props.errorComponent\` prop
|
|
2104
2104
|
|
|
2105
2105
|
- Type: \`React.ReactNode\`
|
|
2106
|
-
- Optional - [\`default: ErrorComponent\`](
|
|
2106
|
+
- Optional - [\`default: ErrorComponent\`](./errorComponentComponent.md)
|
|
2107
2107
|
- The component to render when there is an error.
|
|
2108
2108
|
|
|
2109
2109
|
### \`props.onCatch\` prop
|
|
@@ -2245,7 +2245,7 @@ The \`createFileRoute\` function accepts a single argument of type \`string\` th
|
|
|
2245
2245
|
|
|
2246
2246
|
## createFileRoute returns
|
|
2247
2247
|
|
|
2248
|
-
A new function that accepts a single argument of type [\`RouteOptions\`](
|
|
2248
|
+
A new function that accepts a single argument of type [\`RouteOptions\`](./RouteOptionsType.md) that will be used to configure the file [\`Route\`](./RouteType.md) instance.
|
|
2249
2249
|
|
|
2250
2250
|
> ⚠️ Note: For \`tsr generate\` and \`tsr watch\` to work properly, the file route instance must be exported from the file using the \`Route\` identifier.
|
|
2251
2251
|
|
|
@@ -2269,7 +2269,7 @@ function IndexComponent() {
|
|
|
2269
2269
|
|
|
2270
2270
|
# createLazyFileRoute function
|
|
2271
2271
|
|
|
2272
|
-
The \`createLazyFileRoute\` function is used for creating a partial file-based route route instance that is lazily loaded when matched. This route instance can only be used to configure the [non-critical properties](
|
|
2272
|
+
The \`createLazyFileRoute\` function is used for creating a partial file-based route route instance that is lazily loaded when matched. This route instance can only be used to configure the [non-critical properties](../../guide/code-splitting.md#how-does-tanstack-router-split-code) of the route, such as \`component\`, \`pendingComponent\`, \`errorComponent\`, and the \`notFoundComponent\`.
|
|
2273
2273
|
|
|
2274
2274
|
## createLazyFileRoute options
|
|
2275
2275
|
|
|
@@ -2283,7 +2283,7 @@ The \`createLazyFileRoute\` function accepts a single argument of type \`string\
|
|
|
2283
2283
|
|
|
2284
2284
|
### createLazyFileRoute returns
|
|
2285
2285
|
|
|
2286
|
-
A new function that accepts a single argument of partial of the type [\`RouteOptions\`](
|
|
2286
|
+
A new function that accepts a single argument of partial of the type [\`RouteOptions\`](./RouteOptionsType.md) that will be used to configure the file [\`Route\`](./RouteType.md) instance.
|
|
2287
2287
|
|
|
2288
2288
|
- Type:
|
|
2289
2289
|
|
|
@@ -2294,7 +2294,7 @@ Pick<
|
|
|
2294
2294
|
>
|
|
2295
2295
|
\`\`\`
|
|
2296
2296
|
|
|
2297
|
-
- [\`RouteOptions\`](
|
|
2297
|
+
- [\`RouteOptions\`](./RouteOptionsType.md)
|
|
2298
2298
|
|
|
2299
2299
|
> ⚠️ Note: For \`tsr generate\` and \`tsr watch\` to work properly, the file route instance must be exported from the file using the \`Route\` identifier.
|
|
2300
2300
|
|
|
@@ -2315,7 +2315,7 @@ function IndexComponent() {
|
|
|
2315
2315
|
|
|
2316
2316
|
# createLazyRoute function
|
|
2317
2317
|
|
|
2318
|
-
The \`createLazyRoute\` function is used for creating a partial code-based route route instance that is lazily loaded when matched. This route instance can only be used to configure the [non-critical properties](
|
|
2318
|
+
The \`createLazyRoute\` function is used for creating a partial code-based route route instance that is lazily loaded when matched. This route instance can only be used to configure the [non-critical properties](../../guide/code-splitting.md#how-does-tanstack-router-split-code) of the route, such as \`component\`, \`pendingComponent\`, \`errorComponent\`, and the \`notFoundComponent\`.
|
|
2319
2319
|
|
|
2320
2320
|
## createLazyRoute options
|
|
2321
2321
|
|
|
@@ -2329,7 +2329,7 @@ The \`createLazyRoute\` function accepts a single argument of type \`string\` th
|
|
|
2329
2329
|
|
|
2330
2330
|
### createLazyRoute returns
|
|
2331
2331
|
|
|
2332
|
-
A new function that accepts a single argument of partial of the type [\`RouteOptions\`](
|
|
2332
|
+
A new function that accepts a single argument of partial of the type [\`RouteOptions\`](./RouteOptionsType.md) that will be used to configure the file [\`Route\`](./RouteType.md) instance.
|
|
2333
2333
|
|
|
2334
2334
|
- Type:
|
|
2335
2335
|
|
|
@@ -2340,7 +2340,7 @@ Pick<
|
|
|
2340
2340
|
>
|
|
2341
2341
|
\`\`\`
|
|
2342
2342
|
|
|
2343
|
-
- [\`RouteOptions\`](
|
|
2343
|
+
- [\`RouteOptions\`](./RouteOptionsType.md)
|
|
2344
2344
|
|
|
2345
2345
|
> ⚠️ Note: This route instance must be manually lazily loaded against its critical route instance using the \`lazy\` method returned by the \`createRoute\` function.
|
|
2346
2346
|
|
|
@@ -2404,12 +2404,12 @@ Omit<
|
|
|
2404
2404
|
>
|
|
2405
2405
|
\`\`\`
|
|
2406
2406
|
|
|
2407
|
-
- [\`RouteOptions\`](
|
|
2407
|
+
- [\`RouteOptions\`](./RouteOptionsType.md)
|
|
2408
2408
|
- Optional
|
|
2409
2409
|
|
|
2410
2410
|
## createRootRoute returns
|
|
2411
2411
|
|
|
2412
|
-
A new [\`Route\`](
|
|
2412
|
+
A new [\`Route\`](./RouteType.md) instance.
|
|
2413
2413
|
|
|
2414
2414
|
## Examples
|
|
2415
2415
|
|
|
@@ -2446,8 +2446,8 @@ The \`createRootRouteWithContext\` function accepts a single generic argument:
|
|
|
2446
2446
|
|
|
2447
2447
|
## createRootRouteWithContext returns
|
|
2448
2448
|
|
|
2449
|
-
- A factory function that can be used to create a new [\`createRootRoute\`](
|
|
2450
|
-
- It accepts a single argument, the same as the [\`createRootRoute\`](
|
|
2449
|
+
- A factory function that can be used to create a new [\`createRootRoute\`](./createRootRouteFunction.md) instance.
|
|
2450
|
+
- It accepts a single argument, the same as the [\`createRootRoute\`](./createRootRouteFunction.md) function.
|
|
2451
2451
|
|
|
2452
2452
|
## Examples
|
|
2453
2453
|
|
|
@@ -2483,17 +2483,17 @@ const router = createRouter({
|
|
|
2483
2483
|
|
|
2484
2484
|
# createRoute function
|
|
2485
2485
|
|
|
2486
|
-
The \`createRoute\` function implements returns a [\`Route\`](
|
|
2486
|
+
The \`createRoute\` function implements returns a [\`Route\`](./RouteType.md) instance. A route instance can then be passed to a root route's children to create a route tree, which is then passed to the router.
|
|
2487
2487
|
|
|
2488
2488
|
## createRoute options
|
|
2489
2489
|
|
|
2490
|
-
- Type: [\`RouteOptions\`](
|
|
2490
|
+
- Type: [\`RouteOptions\`](./RouteOptionsType.md)
|
|
2491
2491
|
- Required
|
|
2492
2492
|
- The options that will be used to configure the route instance
|
|
2493
2493
|
|
|
2494
2494
|
## createRoute returns
|
|
2495
2495
|
|
|
2496
|
-
A new [\`Route\`](
|
|
2496
|
+
A new [\`Route\`](./RouteType.md) instance.
|
|
2497
2497
|
|
|
2498
2498
|
## Examples
|
|
2499
2499
|
|
|
@@ -2522,13 +2522,13 @@ The \`createRouteMask\` function is a helper function that can be used to create
|
|
|
2522
2522
|
|
|
2523
2523
|
## createRouteMask options
|
|
2524
2524
|
|
|
2525
|
-
- Type: [\`RouteMask\`](
|
|
2525
|
+
- Type: [\`RouteMask\`](./RouteMaskType.md)
|
|
2526
2526
|
- Required
|
|
2527
2527
|
- The options that will be used to configure the route mask
|
|
2528
2528
|
|
|
2529
2529
|
## createRouteMask returns
|
|
2530
2530
|
|
|
2531
|
-
- A object with the type signature of [\`RouteMask\`](
|
|
2531
|
+
- A object with the type signature of [\`RouteMask\`](./RouteMaskType.md) that can be passed to the \`RouterOptions.routeMasks\` option.
|
|
2532
2532
|
|
|
2533
2533
|
## Examples
|
|
2534
2534
|
|
|
@@ -2551,17 +2551,17 @@ const router = createRouter({
|
|
|
2551
2551
|
|
|
2552
2552
|
# createRouter function
|
|
2553
2553
|
|
|
2554
|
-
The \`createRouter\` function accepts a [\`RouterOptions\`](
|
|
2554
|
+
The \`createRouter\` function accepts a [\`RouterOptions\`](./RouterOptionsType.md) object and creates a new [\`Router\`](./RouterClass.md) instance.
|
|
2555
2555
|
|
|
2556
2556
|
## createRouter options
|
|
2557
2557
|
|
|
2558
|
-
- Type: [\`RouterOptions\`](
|
|
2558
|
+
- Type: [\`RouterOptions\`](./RouterOptionsType.md)
|
|
2559
2559
|
- Required
|
|
2560
2560
|
- The options that will be used to configure the router instance.
|
|
2561
2561
|
|
|
2562
2562
|
## createRouter returns
|
|
2563
2563
|
|
|
2564
|
-
- An instance of the [\`Router\`](
|
|
2564
|
+
- An instance of the [\`Router\`](./RouterType.md).
|
|
2565
2565
|
|
|
2566
2566
|
## Examples
|
|
2567
2567
|
|
|
@@ -2594,7 +2594,7 @@ The \`DefaultGlobalNotFound\` component is a component that renders "Not Found"
|
|
|
2594
2594
|
> [!CAUTION]
|
|
2595
2595
|
> You don't need to call \`defer\` manually anymore, Promises are handled automatically now.
|
|
2596
2596
|
|
|
2597
|
-
The \`defer\` function wraps a promise with a deferred state object that can be used to inspect the promise's state. This deferred promise can then be passed to the [\`useAwaited\`](
|
|
2597
|
+
The \`defer\` function wraps a promise with a deferred state object that can be used to inspect the promise's state. This deferred promise can then be passed to the [\`useAwaited\`](./useAwaitedHook.md) hook or the [\`<Await>\`](./awaitComponent.md) component for suspending until the promise is resolved or rejected.
|
|
2598
2598
|
|
|
2599
2599
|
The \`defer\` function accepts a single argument, the \`promise\` to wrap with a deferred state object.
|
|
2600
2600
|
|
|
@@ -2606,7 +2606,7 @@ The \`defer\` function accepts a single argument, the \`promise\` to wrap with a
|
|
|
2606
2606
|
|
|
2607
2607
|
## defer returns
|
|
2608
2608
|
|
|
2609
|
-
- A promise that can be passed to the [\`useAwaited\`](
|
|
2609
|
+
- A promise that can be passed to the [\`useAwaited\`](./useAwaitedHook.md) hook or the [\`<Await>\`](./awaitComponent.md) component.
|
|
2610
2610
|
|
|
2611
2611
|
## Examples
|
|
2612
2612
|
|
|
@@ -2678,11 +2678,11 @@ The \`getRouteApi\` function accepts a single argument, a \`routeId\` string lit
|
|
|
2678
2678
|
|
|
2679
2679
|
- Type: \`string\`
|
|
2680
2680
|
- Required
|
|
2681
|
-
- The route ID to which the [\`RouteApi\`](
|
|
2681
|
+
- The route ID to which the [\`RouteApi\`](./RouteApiClass.md) instance will be bound
|
|
2682
2682
|
|
|
2683
2683
|
## getRouteApi returns
|
|
2684
2684
|
|
|
2685
|
-
- An instance of the [\`RouteApi\`](
|
|
2685
|
+
- An instance of the [\`RouteApi\`](./RouteApiType.md) that is pre-bound to the route ID that the \`getRouteApi\` function was called with.
|
|
2686
2686
|
|
|
2687
2687
|
## Examples
|
|
2688
2688
|
|
|
@@ -2717,7 +2717,7 @@ declare module '@tanstack/react-router' {
|
|
|
2717
2717
|
|
|
2718
2718
|
# isNotFound function
|
|
2719
2719
|
|
|
2720
|
-
The \`isNotFound\` function can be used to determine if an object is a [\`NotFoundError\`](
|
|
2720
|
+
The \`isNotFound\` function can be used to determine if an object is a [\`NotFoundError\`](./NotFoundErrorType.md) object.
|
|
2721
2721
|
|
|
2722
2722
|
## isNotFound options
|
|
2723
2723
|
|
|
@@ -2727,13 +2727,13 @@ The \`isNotFound\` function accepts a single argument, an \`input\`.
|
|
|
2727
2727
|
|
|
2728
2728
|
- Type: \`unknown\`
|
|
2729
2729
|
- Required
|
|
2730
|
-
- An object to check if it is a [\`NotFoundError\`](
|
|
2730
|
+
- An object to check if it is a [\`NotFoundError\`](./NotFoundErrorType.md).
|
|
2731
2731
|
|
|
2732
2732
|
## isNotFound returns
|
|
2733
2733
|
|
|
2734
2734
|
- Type: \`boolean\`
|
|
2735
|
-
- \`true\` if the object is a [\`NotFoundError\`](
|
|
2736
|
-
- \`false\` if the object is not a [\`NotFoundError\`](
|
|
2735
|
+
- \`true\` if the object is a [\`NotFoundError\`](./NotFoundErrorType.md).
|
|
2736
|
+
- \`false\` if the object is not a [\`NotFoundError\`](./NotFoundErrorType.md).
|
|
2737
2737
|
|
|
2738
2738
|
## Examples
|
|
2739
2739
|
|
|
@@ -2838,7 +2838,7 @@ The \`Link\` component accepts the following props:
|
|
|
2838
2838
|
### \`...props\`
|
|
2839
2839
|
|
|
2840
2840
|
- Type: \`LinkProps & React.RefAttributes<HTMLAnchorElement>\`
|
|
2841
|
-
- [\`LinkProps\`](
|
|
2841
|
+
- [\`LinkProps\`](./LinkPropsType.md)
|
|
2842
2842
|
|
|
2843
2843
|
## Link returns
|
|
2844
2844
|
|
|
@@ -2873,7 +2873,7 @@ The \`linkOptions\` accepts the following option:
|
|
|
2873
2873
|
### \`...props\`
|
|
2874
2874
|
|
|
2875
2875
|
- Type: \`LinkProps & React.RefAttributes<HTMLAnchorElement>\`
|
|
2876
|
-
- [\`LinkProps\`](
|
|
2876
|
+
- [\`LinkProps\`](./LinkPropsType.md)
|
|
2877
2877
|
|
|
2878
2878
|
## \`linkOptions\` returns
|
|
2879
2879
|
|
|
@@ -2908,7 +2908,7 @@ The \`MatchRoute\` component accepts the same options as the \`useMatchRoute\` h
|
|
|
2908
2908
|
|
|
2909
2909
|
### \`...props\` prop
|
|
2910
2910
|
|
|
2911
|
-
- Type: [\`UseMatchRouteOptions\`](
|
|
2911
|
+
- Type: [\`UseMatchRouteOptions\`](./UseMatchRouteOptionsType.md)
|
|
2912
2912
|
|
|
2913
2913
|
### \`children\` prop
|
|
2914
2914
|
|
|
@@ -2948,7 +2948,7 @@ The \`Navigate\` component accepts the following props:
|
|
|
2948
2948
|
|
|
2949
2949
|
### \`...options\`
|
|
2950
2950
|
|
|
2951
|
-
- Type: [\`NavigateOptions\`](
|
|
2951
|
+
- Type: [\`NavigateOptions\`](./NavigateOptionsType.md)
|
|
2952
2952
|
|
|
2953
2953
|
## Navigate returns
|
|
2954
2954
|
|
|
@@ -2996,7 +2996,7 @@ The \`notFound\` function returns a new \`NotFoundError\` object that can be eit
|
|
|
2996
2996
|
|
|
2997
2997
|
The \`notFound\` function accepts a single optional argument, the \`options\` to create the not-found error object.
|
|
2998
2998
|
|
|
2999
|
-
- Type: [\`Partial<NotFoundError>\`](
|
|
2999
|
+
- Type: [\`Partial<NotFoundError>\`](./NotFoundErrorType.md)
|
|
3000
3000
|
- Optional
|
|
3001
3001
|
|
|
3002
3002
|
## notFound returns
|
|
@@ -3047,7 +3047,7 @@ The \`redirect\` function returns a new \`Redirect\` object that can be either r
|
|
|
3047
3047
|
|
|
3048
3048
|
The \`redirect\` function accepts a single argument, the \`options\` to determine the redirect behavior.
|
|
3049
3049
|
|
|
3050
|
-
- Type: [\`Redirect\`](
|
|
3050
|
+
- Type: [\`Redirect\`](./RedirectType.md)
|
|
3051
3051
|
- Required
|
|
3052
3052
|
|
|
3053
3053
|
## redirect returns
|
|
@@ -3140,7 +3140,7 @@ export const Route = createFileRoute('/')({
|
|
|
3140
3140
|
|
|
3141
3141
|
> [!CAUTION]
|
|
3142
3142
|
> This function is deprecated and will be removed in the next major version of TanStack Router.
|
|
3143
|
-
> Please use the [\`createRootRouteWithContext\`](
|
|
3143
|
+
> Please use the [\`createRootRouteWithContext\`](./createRootRouteWithContextFunction.md) function instead.
|
|
3144
3144
|
|
|
3145
3145
|
The \`rootRouteWithContext\` function is a helper function that can be used to create a root route instance that requires a context type to be fulfilled when the router is created.
|
|
3146
3146
|
|
|
@@ -3156,8 +3156,8 @@ The \`rootRouteWithContext\` function accepts a single generic argument:
|
|
|
3156
3156
|
|
|
3157
3157
|
## rootRouteWithContext returns
|
|
3158
3158
|
|
|
3159
|
-
- A factory function that can be used to create a new [\`createRootRoute\`](
|
|
3160
|
-
- It accepts a single argument, the same as the [\`createRootRoute\`](
|
|
3159
|
+
- A factory function that can be used to create a new [\`createRootRoute\`](./createRootRouteFunction.md) instance.
|
|
3160
|
+
- It accepts a single argument, the same as the [\`createRootRoute\`](./createRootRouteFunction.md) function.
|
|
3161
3161
|
|
|
3162
3162
|
## Examples
|
|
3163
3163
|
|
|
@@ -3299,7 +3299,7 @@ function Component() {
|
|
|
3299
3299
|
|
|
3300
3300
|
# useBlocker hook
|
|
3301
3301
|
|
|
3302
|
-
The \`useBlocker\` method is a hook that [blocks navigation](
|
|
3302
|
+
The \`useBlocker\` method is a hook that [blocks navigation](../../guide/navigation-blocking.md) when a condition is met.
|
|
3303
3303
|
|
|
3304
3304
|
> ⚠️ The following new \`useBlocker\` API is currently _experimental_.
|
|
3305
3305
|
|
|
@@ -3521,7 +3521,7 @@ The \`useCanGoBack\` hook returns a boolean representing if the router history c
|
|
|
3521
3521
|
|
|
3522
3522
|
## Limitations
|
|
3523
3523
|
|
|
3524
|
-
The router history index is reset after a navigation with [\`reloadDocument\`](
|
|
3524
|
+
The router history index is reset after a navigation with [\`reloadDocument\`](./NavigateOptionsType.md#reloaddocument) set as \`true\`. This causes the router history to consider the new location as the initial one and will cause \`useCanGoBack\` to return \`false\`.
|
|
3525
3525
|
|
|
3526
3526
|
## Examples
|
|
3527
3527
|
|
|
@@ -3548,7 +3548,7 @@ function Component() {
|
|
|
3548
3548
|
|
|
3549
3549
|
# useChildMatches hook
|
|
3550
3550
|
|
|
3551
|
-
The \`useChildMatches\` hook returns all of the child [\`RouteMatch\`](
|
|
3551
|
+
The \`useChildMatches\` hook returns all of the child [\`RouteMatch\`](./RouteMatchType.md) objects from the closest match down to the leaf-most match. **It does not include the current match, which can be obtained using the \`useMatch\` hook.**
|
|
3552
3552
|
|
|
3553
3553
|
> [!IMPORTANT]
|
|
3554
3554
|
> If the router has pending matches and they are showing their pending component fallbacks, \`router.state.pendingMatches\` will used instead of \`router.state.matches\`.
|
|
@@ -3568,12 +3568,12 @@ The \`useChildMatches\` hook accepts a single _optional_ argument, an \`options\
|
|
|
3568
3568
|
- Type: \`boolean\`
|
|
3569
3569
|
- Optional
|
|
3570
3570
|
- Configures whether structural sharing is enabled for the value returned by \`select\`.
|
|
3571
|
-
- See the [Render Optimizations guide](
|
|
3571
|
+
- See the [Render Optimizations guide](../../guide/render-optimizations.md) for more information.
|
|
3572
3572
|
|
|
3573
3573
|
## useChildMatches returns
|
|
3574
3574
|
|
|
3575
3575
|
- If a \`select\` function is provided, the return value of the \`select\` function.
|
|
3576
|
-
- If no \`select\` function is provided, an array of [\`RouteMatch\`](
|
|
3576
|
+
- If no \`select\` function is provided, an array of [\`RouteMatch\`](./RouteMatchType.md) objects.
|
|
3577
3577
|
|
|
3578
3578
|
## Examples
|
|
3579
3579
|
|
|
@@ -3597,9 +3597,9 @@ type UseLinkPropsOptions = ActiveLinkOptions &
|
|
|
3597
3597
|
React.AnchorHTMLAttributes<HTMLAnchorElement>
|
|
3598
3598
|
\`\`\`
|
|
3599
3599
|
|
|
3600
|
-
- [\`ActiveLinkOptions\`](
|
|
3601
|
-
- The \`useLinkProps\` options are used to build a [\`LinkProps\`](
|
|
3602
|
-
- It also extends the \`React.AnchorHTMLAttributes<HTMLAnchorElement>\` type, so that any additional props that are passed to the \`useLinkProps\` hook will be merged with the [\`LinkProps\`](
|
|
3600
|
+
- [\`ActiveLinkOptions\`](./ActiveLinkOptionsType.md)
|
|
3601
|
+
- The \`useLinkProps\` options are used to build a [\`LinkProps\`](./LinkPropsType.md) object.
|
|
3602
|
+
- It also extends the \`React.AnchorHTMLAttributes<HTMLAnchorElement>\` type, so that any additional props that are passed to the \`useLinkProps\` hook will be merged with the [\`LinkProps\`](./LinkPropsType.md) object.
|
|
3603
3603
|
|
|
3604
3604
|
## useLinkProps returns
|
|
3605
3605
|
|
|
@@ -3607,7 +3607,7 @@ type UseLinkPropsOptions = ActiveLinkOptions &
|
|
|
3607
3607
|
|
|
3608
3608
|
# useLoaderData hook
|
|
3609
3609
|
|
|
3610
|
-
The \`useLoaderData\` hook returns the loader data from the closest [\`RouteMatch\`](
|
|
3610
|
+
The \`useLoaderData\` hook returns the loader data from the closest [\`RouteMatch\`](./RouteMatchType.md) in the component tree.
|
|
3611
3611
|
|
|
3612
3612
|
## useLoaderData options
|
|
3613
3613
|
|
|
@@ -3638,7 +3638,7 @@ The \`useLoaderData\` hook accepts an \`options\` object.
|
|
|
3638
3638
|
- Type: \`boolean\`
|
|
3639
3639
|
- Optional
|
|
3640
3640
|
- Configures whether structural sharing is enabled for the value returned by \`select\`.
|
|
3641
|
-
- See the [Render Optimizations guide](
|
|
3641
|
+
- See the [Render Optimizations guide](../../guide/render-optimizations.md) for more information.
|
|
3642
3642
|
|
|
3643
3643
|
## useLoaderData returns
|
|
3644
3644
|
|
|
@@ -3682,7 +3682,7 @@ The \`useLoaderDepsHook\` hook accepts an \`options\` object.
|
|
|
3682
3682
|
- Type: \`boolean\`
|
|
3683
3683
|
- Optional
|
|
3684
3684
|
- Configures whether structural sharing is enabled for the value returned by \`select\`.
|
|
3685
|
-
- See the [Render Optimizations guide](
|
|
3685
|
+
- See the [Render Optimizations guide](../../guide/render-optimizations.md) for more information.
|
|
3686
3686
|
|
|
3687
3687
|
## useLoaderDeps returns
|
|
3688
3688
|
|
|
@@ -3715,7 +3715,7 @@ function Component() {
|
|
|
3715
3715
|
|
|
3716
3716
|
# useLocation hook
|
|
3717
3717
|
|
|
3718
|
-
The \`useLocation\` method is a hook that returns the current [\`location\`](
|
|
3718
|
+
The \`useLocation\` method is a hook that returns the current [\`location\`](./ParsedLocationType.md) object. This hook is useful for when you want to perform some side effect whenever the current location changes.
|
|
3719
3719
|
|
|
3720
3720
|
## useLocation options
|
|
3721
3721
|
|
|
@@ -3725,11 +3725,11 @@ The \`useLocation\` hook accepts an optional \`options\` object.
|
|
|
3725
3725
|
|
|
3726
3726
|
- Type: \`(state: ParsedLocationType) => TSelected\`
|
|
3727
3727
|
- Optional
|
|
3728
|
-
- If supplied, this function will be called with the [\`location\`](
|
|
3728
|
+
- If supplied, this function will be called with the [\`location\`](./ParsedLocationType.md) object and the return value will be returned from \`useLocation\`.
|
|
3729
3729
|
|
|
3730
3730
|
## useLocation returns
|
|
3731
3731
|
|
|
3732
|
-
- The current [\`location\`](
|
|
3732
|
+
- The current [\`location\`](./ParsedLocationType.md) object or \`TSelected\` if a \`select\` function is provided.
|
|
3733
3733
|
|
|
3734
3734
|
## Examples
|
|
3735
3735
|
|
|
@@ -3753,7 +3753,7 @@ function Component() {
|
|
|
3753
3753
|
|
|
3754
3754
|
# useMatch hook
|
|
3755
3755
|
|
|
3756
|
-
The \`useMatch\` hook returns a [\`RouteMatch\`](
|
|
3756
|
+
The \`useMatch\` hook returns a [\`RouteMatch\`](./RouteMatchType.md) in the component tree. The raw route match contains all of the information about a route match in the router and also powers many other hooks under the hood like \`useParams\`, \`useLoaderData\`, \`useRouteContext\`, and \`useSearch\`.
|
|
3757
3757
|
|
|
3758
3758
|
## useMatch options
|
|
3759
3759
|
|
|
@@ -3765,7 +3765,7 @@ The \`useMatch\` hook accepts a single argument, an \`options\` object.
|
|
|
3765
3765
|
- The route id of a match
|
|
3766
3766
|
- Optional, but recommended for full type safety.
|
|
3767
3767
|
- If \`opts.strict\` is \`true\`, \`from\` is required and TypeScript will warn for this option if it is not provided.
|
|
3768
|
-
- If \`opts.strict\` is \`false\`, \`from\` must not be set and TypeScript will provided loosened types for the returned [\`RouteMatch\`](
|
|
3768
|
+
- If \`opts.strict\` is \`false\`, \`from\` must not be set and TypeScript will provided loosened types for the returned [\`RouteMatch\`](./RouteMatchType.md).
|
|
3769
3769
|
|
|
3770
3770
|
### \`opts.strict\` option
|
|
3771
3771
|
|
|
@@ -3785,7 +3785,7 @@ The \`useMatch\` hook accepts a single argument, an \`options\` object.
|
|
|
3785
3785
|
- Type: \`boolean\`
|
|
3786
3786
|
- Optional
|
|
3787
3787
|
- Configures whether structural sharing is enabled for the value returned by \`select\`.
|
|
3788
|
-
- See the [Render Optimizations guide](
|
|
3788
|
+
- See the [Render Optimizations guide](../../guide/render-optimizations.md) for more information.
|
|
3789
3789
|
|
|
3790
3790
|
### \`opts.shouldThrow\` option
|
|
3791
3791
|
|
|
@@ -3797,7 +3797,7 @@ The \`useMatch\` hook accepts a single argument, an \`options\` object.
|
|
|
3797
3797
|
## useMatch returns
|
|
3798
3798
|
|
|
3799
3799
|
- If a \`select\` function is provided, the return value of the \`select\` function.
|
|
3800
|
-
- If no \`select\` function is provided, the [\`RouteMatch\`](
|
|
3800
|
+
- If no \`select\` function is provided, the [\`RouteMatch\`](./RouteMatchType.md) object or a loosened version of the \`RouteMatch\` object if \`opts.strict\` is \`false\`.
|
|
3801
3801
|
|
|
3802
3802
|
## Examples
|
|
3803
3803
|
|
|
@@ -3858,7 +3858,7 @@ The \`matchRoute\` function is a function that can be used to match a route agai
|
|
|
3858
3858
|
|
|
3859
3859
|
The \`matchRoute\` function accepts a single argument, an \`options\` object.
|
|
3860
3860
|
|
|
3861
|
-
- Type: [\`UseMatchRouteOptions\`](
|
|
3861
|
+
- Type: [\`UseMatchRouteOptions\`](./UseMatchRouteOptionsType.md)
|
|
3862
3862
|
|
|
3863
3863
|
### matchRoute function returns
|
|
3864
3864
|
|
|
@@ -3958,10 +3958,10 @@ function Component() {
|
|
|
3958
3958
|
|
|
3959
3959
|
# useMatches hook
|
|
3960
3960
|
|
|
3961
|
-
The \`useMatches\` hook returns all of the [\`RouteMatch\`](
|
|
3961
|
+
The \`useMatches\` hook returns all of the [\`RouteMatch\`](./RouteMatchType.md) objects from the router **regardless of its callers position in the React component tree**.
|
|
3962
3962
|
|
|
3963
3963
|
> [!TIP]
|
|
3964
|
-
> If you only want the parent or child matches, then you can use the [\`useParentMatches\`](
|
|
3964
|
+
> If you only want the parent or child matches, then you can use the [\`useParentMatches\`](./useParentMatchesHook.md) or the [\`useChildMatches\`](./useChildMatchesHook.md) based on the selection you need.
|
|
3965
3965
|
|
|
3966
3966
|
## useMatches options
|
|
3967
3967
|
|
|
@@ -3978,12 +3978,12 @@ The \`useMatches\` hook accepts a single _optional_ argument, an \`options\` obj
|
|
|
3978
3978
|
- Type: \`boolean\`
|
|
3979
3979
|
- Optional
|
|
3980
3980
|
- Configures whether structural sharing is enabled for the value returned by \`select\`.
|
|
3981
|
-
- See the [Render Optimizations guide](
|
|
3981
|
+
- See the [Render Optimizations guide](../../guide/render-optimizations.md) for more information.
|
|
3982
3982
|
|
|
3983
3983
|
## useMatches returns
|
|
3984
3984
|
|
|
3985
3985
|
- If a \`select\` function is provided, the return value of the \`select\` function.
|
|
3986
|
-
- If no \`select\` function is provided, an array of [\`RouteMatch\`](
|
|
3986
|
+
- If no \`select\` function is provided, an array of [\`RouteMatch\`](./RouteMatchType.md) objects.
|
|
3987
3987
|
|
|
3988
3988
|
## Examples
|
|
3989
3989
|
|
|
@@ -4023,7 +4023,7 @@ The \`navigate\` function is a function that can be used to navigate to a new lo
|
|
|
4023
4023
|
|
|
4024
4024
|
The \`navigate\` function accepts a single argument, an \`options\` object.
|
|
4025
4025
|
|
|
4026
|
-
- Type: [\`NavigateOptions\`](
|
|
4026
|
+
- Type: [\`NavigateOptions\`](./NavigateOptionsType.md)
|
|
4027
4027
|
|
|
4028
4028
|
### navigate function returns
|
|
4029
4029
|
|
|
@@ -4120,7 +4120,7 @@ The \`useParams\` hook accepts an optional \`options\` object.
|
|
|
4120
4120
|
- Type: \`boolean\`
|
|
4121
4121
|
- Optional
|
|
4122
4122
|
- Configures whether structural sharing is enabled for the value returned by \`select\`.
|
|
4123
|
-
- See the [Render Optimizations guide](
|
|
4123
|
+
- See the [Render Optimizations guide](../../guide/render-optimizations.md) for more information.
|
|
4124
4124
|
|
|
4125
4125
|
## useParams returns
|
|
4126
4126
|
|
|
@@ -4157,7 +4157,7 @@ function Component() {
|
|
|
4157
4157
|
|
|
4158
4158
|
# useParentMatches hook
|
|
4159
4159
|
|
|
4160
|
-
The \`useParentMatches\` hook returns all of the parent [\`RouteMatch\`](
|
|
4160
|
+
The \`useParentMatches\` hook returns all of the parent [\`RouteMatch\`](./RouteMatchType.md) objects from the root down to the immediate parent of the current match in context. **It does not include the current match, which can be obtained using the \`useMatch\` hook.**
|
|
4161
4161
|
|
|
4162
4162
|
> [!IMPORTANT]
|
|
4163
4163
|
> If the router has pending matches and they are showing their pending component fallbacks, \`router.state.pendingMatches\` will used instead of \`router.state.matches\`.
|
|
@@ -4177,12 +4177,12 @@ The \`useParentMatches\` hook accepts an optional \`options\` object.
|
|
|
4177
4177
|
- Type: \`boolean\`
|
|
4178
4178
|
- Optional
|
|
4179
4179
|
- Configures whether structural sharing is enabled for the value returned by \`select\`.
|
|
4180
|
-
- See the [Render Optimizations guide](
|
|
4180
|
+
- See the [Render Optimizations guide](../../guide/render-optimizations.md) for more information.
|
|
4181
4181
|
|
|
4182
4182
|
## useParentMatches returns
|
|
4183
4183
|
|
|
4184
4184
|
- If a \`select\` function is provided, the return value of the \`select\` function.
|
|
4185
|
-
- If no \`select\` function is provided, an array of [\`RouteMatch\`](
|
|
4185
|
+
- If no \`select\` function is provided, an array of [\`RouteMatch\`](./RouteMatchType.md) objects.
|
|
4186
4186
|
|
|
4187
4187
|
## Examples
|
|
4188
4188
|
|
|
@@ -4242,13 +4242,13 @@ function Component() {
|
|
|
4242
4242
|
|
|
4243
4243
|
# useRouter hook
|
|
4244
4244
|
|
|
4245
|
-
The \`useRouter\` method is a hook that returns the current instance of [\`Router\`](
|
|
4245
|
+
The \`useRouter\` method is a hook that returns the current instance of [\`Router\`](./RouterType.md) from context. This hook is useful for accessing the router instance in a component.
|
|
4246
4246
|
|
|
4247
4247
|
## useRouter returns
|
|
4248
4248
|
|
|
4249
|
-
- The current [\`Router\`](
|
|
4249
|
+
- The current [\`Router\`](./RouterType.md) instance.
|
|
4250
4250
|
|
|
4251
|
-
> ⚠️⚠️⚠️ **\`router.state\` is always up to date, but NOT REACTIVE. If you use \`router.state\` in a component, the component will not re-render when the router state changes. To get a reactive version of the router state, use the [\`useRouterState\`](
|
|
4251
|
+
> ⚠️⚠️⚠️ **\`router.state\` is always up to date, but NOT REACTIVE. If you use \`router.state\` in a component, the component will not re-render when the router state changes. To get a reactive version of the router state, use the [\`useRouterState\`](./useRouterStateHook.md) hook.**
|
|
4252
4252
|
|
|
4253
4253
|
## Examples
|
|
4254
4254
|
|
|
@@ -4268,7 +4268,7 @@ function Component() {
|
|
|
4268
4268
|
The \`useRouterState\` method is a hook that returns the current internal state of the router. This hook is useful for accessing the current state of the router in a component.
|
|
4269
4269
|
|
|
4270
4270
|
> [!TIP]
|
|
4271
|
-
> If you want to access the current location or the current matches, you should try out the [\`useLocation\`](
|
|
4271
|
+
> If you want to access the current location or the current matches, you should try out the [\`useLocation\`](./useLocationHook.md) and [\`useMatches\`](./useMatchesHook.md) hooks first. These hooks are designed to be more ergonomic and easier to use than accessing the router state directly.
|
|
4272
4272
|
|
|
4273
4273
|
## useRouterState options
|
|
4274
4274
|
|
|
@@ -4278,18 +4278,18 @@ The \`useRouterState\` hook accepts an optional \`options\` object.
|
|
|
4278
4278
|
|
|
4279
4279
|
- Type: \`(state: RouterState) => TSelected\`
|
|
4280
4280
|
- Optional
|
|
4281
|
-
- If supplied, this function will be called with the [\`RouterState\`](
|
|
4281
|
+
- If supplied, this function will be called with the [\`RouterState\`](./RouterStateType.md) object and the return value will be returned from \`useRouterState\`.
|
|
4282
4282
|
|
|
4283
4283
|
### \`opts.structuralSharing\` option
|
|
4284
4284
|
|
|
4285
4285
|
- Type: \`boolean\`
|
|
4286
4286
|
- Optional
|
|
4287
4287
|
- Configures whether structural sharing is enabled for the value returned by \`select\`.
|
|
4288
|
-
- See the [Render Optimizations guide](
|
|
4288
|
+
- See the [Render Optimizations guide](../../guide/render-optimizations.md) for more information.
|
|
4289
4289
|
|
|
4290
4290
|
## useRouterState returns
|
|
4291
4291
|
|
|
4292
|
-
- The current [\`RouterState\`](
|
|
4292
|
+
- The current [\`RouterState\`](./RouterStateType.md) object or \`TSelected\` if a \`select\` function is provided.
|
|
4293
4293
|
|
|
4294
4294
|
## Examples
|
|
4295
4295
|
|
|
@@ -4343,7 +4343,7 @@ The \`useSearch\` hook accepts an \`options\` object.
|
|
|
4343
4343
|
- Type: \`boolean\`
|
|
4344
4344
|
- Optional
|
|
4345
4345
|
- Configures whether structural sharing is enabled for the value returned by \`select\`.
|
|
4346
|
-
- See the [Render Optimizations guide](
|
|
4346
|
+
- See the [Render Optimizations guide](../../guide/render-optimizations.md) for more information.
|
|
4347
4347
|
|
|
4348
4348
|
### \`opts.strict\` option
|
|
4349
4349
|
|