Skip to content

Commit ae97fce

Browse files
committed
chore: generate markdown docs from jsdocs
1 parent 6d447ce commit ae97fce

18 files changed

+297
-86
lines changed

docs/api/hooks/useAsyncError.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,24 @@ title: useAsyncError
44

55
# useAsyncError
66

7+
<!--
8+
⚠️ ⚠️ IMPORTANT ⚠️ ⚠️
9+
10+
Hey! Thank you for helping improve our documentation!
11+
12+
This file is auto-generated from the JSDoc comments in the source
13+
code, so please find the definition of this API and edit the JSDoc
14+
comments accordingly and this file will be re-generated once those
15+
changes are merged.
16+
-->
17+
718
[MODES: framework, data]
819

920
## Summary
1021

1122
[Reference Documentation ↗](https://api.reactrouter.com/v7/functions/react_router.useAsyncError.html)
1223

13-
Returns the rejection value from the closest [Await](../components/Await).
24+
Returns the rejection value from the closest [`<Await>`](../components/Await).
1425

1526
```tsx
1627
import { Await, useAsyncError } from "react-router";
@@ -34,3 +45,4 @@ function ErrorElement() {
3445
```tsx
3546
useAsyncError(): unknown
3647
```
48+

docs/api/hooks/useAsyncValue.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,24 @@ title: useAsyncValue
44

55
# useAsyncValue
66

7-
[MODES: framework]
7+
<!--
8+
⚠️ ⚠️ IMPORTANT ⚠️ ⚠️
9+
10+
Hey! Thank you for helping improve our documentation!
11+
12+
This file is auto-generated from the JSDoc comments in the source
13+
code, so please find the definition of this API and edit the JSDoc
14+
comments accordingly and this file will be re-generated once those
15+
changes are merged.
16+
-->
17+
18+
[MODES: framework, data]
819

920
## Summary
1021

1122
[Reference Documentation ↗](https://api.reactrouter.com/v7/functions/react_router.useAsyncValue.html)
1223

13-
Returns the resolved promise value from the closest [Await](../components/Await).
24+
Returns the resolved promise value from the closest [`<Await>`](../components/Await).
1425

1526
```tsx
1627
function SomeDescendant() {
@@ -29,3 +40,4 @@ function SomeDescendant() {
2940
```tsx
3041
useAsyncValue(): unknown
3142
```
43+

docs/api/hooks/useHref.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ title: useHref
44

55
# useHref
66

7+
<!--
8+
⚠️ ⚠️ IMPORTANT ⚠️ ⚠️
9+
10+
Hey! Thank you for helping improve our documentation!
11+
12+
This file is auto-generated from the JSDoc comments in the source
13+
code, so please find the definition of this API and edit the JSDoc
14+
comments accordingly and this file will be re-generated once those
15+
changes are merged.
16+
-->
17+
718
[MODES: framework, data, declarative]
819

920
## Summary
@@ -24,19 +35,18 @@ function SomeComponent() {
2435
## Signature
2536

2637
```tsx
27-
useHref(to, __namedParameters): string
38+
useHref(to: To, { relative }: {
39+
relative?: RelativeRoutingType;
40+
} = {}): string
2841
```
2942

3043
## Params
3144

3245
### to
3346

34-
[modes: framework, data, declarative]
35-
36-
_No documentation_
47+
The path to resolve
3748

38-
### \_\_namedParameters
49+
### options.relative
3950

40-
[modes: framework, data, declarative]
51+
Defaults to "route" so routing is relative to the route tree. Set to "path" to make relative routing operate against path segments.
4152

42-
_No documentation_

docs/api/hooks/useInRouterContext.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ title: useInRouterContext
44

55
# useInRouterContext
66

7+
<!--
8+
⚠️ ⚠️ IMPORTANT ⚠️ ⚠️
9+
10+
Hey! Thank you for helping improve our documentation!
11+
12+
This file is auto-generated from the JSDoc comments in the source
13+
code, so please find the definition of this API and edit the JSDoc
14+
comments accordingly and this file will be re-generated once those
15+
changes are merged.
16+
-->
17+
718
[MODES: framework, data]
819

920
## Summary
@@ -18,3 +29,4 @@ a component is used within a Router.
1829
```tsx
1930
useInRouterContext(): boolean
2031
```
32+

docs/api/hooks/useLocation.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,24 @@ title: useLocation
44

55
# useLocation
66

7+
<!--
8+
⚠️ ⚠️ IMPORTANT ⚠️ ⚠️
9+
10+
Hey! Thank you for helping improve our documentation!
11+
12+
This file is auto-generated from the JSDoc comments in the source
13+
code, so please find the definition of this API and edit the JSDoc
14+
comments accordingly and this file will be re-generated once those
15+
changes are merged.
16+
-->
17+
718
[MODES: framework, data, declarative]
819

920
## Summary
1021

1122
[Reference Documentation ↗](https://api.reactrouter.com/v7/functions/react_router.useLocation.html)
1223

13-
Returns the current [Location]([../Other/Location](https://api.reactrouter.com/v7/interfaces/react_router.Location.html)). This can be useful if you'd like to perform some side effect whenever it changes.
24+
Returns the current [`Location`](https://api.reactrouter.com/v7/interfaces/react_router.Location.html). This can be useful if you'd like to perform some side effect whenever it changes.
1425

1526
```tsx
1627
import * as React from 'react'
@@ -35,3 +46,4 @@ function SomeComponent() {
3546
```tsx
3647
useLocation(): Location
3748
```
49+

docs/api/hooks/useMatch.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ title: useMatch
44

55
# useMatch
66

7+
<!--
8+
⚠️ ⚠️ IMPORTANT ⚠️ ⚠️
9+
10+
Hey! Thank you for helping improve our documentation!
11+
12+
This file is auto-generated from the JSDoc comments in the source
13+
code, so please find the definition of this API and edit the JSDoc
14+
comments accordingly and this file will be re-generated once those
15+
changes are merged.
16+
-->
17+
718
[MODES: framework, data, declarative]
819

920
## Summary
@@ -14,19 +25,15 @@ Returns a PathMatch object if the given pattern matches the current URL.
1425
This is useful for components that need to know "active" state, e.g.
1526
`<NavLink>`.
1627

17-
18-
1928
## Signature
2029

2130
```tsx
22-
useMatch(pattern): undefined
31+
useMatch<ParamKey extends ParamParseKey<Path>, Path extends string>(pattern: PathPattern<Path> | Path): PathMatch<ParamKey> | null
2332
```
2433
2534
## Params
2635
2736
### pattern
2837
29-
[modes: framework, data, declarative]
30-
31-
_No documentation_
38+
The pattern to match against the current location
3239

docs/api/hooks/useMatches.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ title: useMatches
44

55
# useMatches
66

7+
<!--
8+
⚠️ ⚠️ IMPORTANT ⚠️ ⚠️
9+
10+
Hey! Thank you for helping improve our documentation!
11+
12+
This file is auto-generated from the JSDoc comments in the source
13+
code, so please find the definition of this API and edit the JSDoc
14+
comments accordingly and this file will be re-generated once those
15+
changes are merged.
16+
-->
17+
718
[MODES: framework, data]
819

920
## Summary
@@ -16,5 +27,6 @@ parent/child routes or the route "handle" property
1627
## Signature
1728

1829
```tsx
19-
useMatches(): undefined
30+
useMatches(): UIMatch[]
2031
```
32+

docs/api/hooks/useNavigate.md

Lines changed: 39 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,57 +4,68 @@ title: useNavigate
44

55
# useNavigate
66

7+
<!--
8+
⚠️ ⚠️ IMPORTANT ⚠️ ⚠️
9+
10+
Hey! Thank you for helping improve our documentation!
11+
12+
This file is auto-generated from the JSDoc comments in the source
13+
code, so please find the definition of this API and edit the JSDoc
14+
comments accordingly and this file will be re-generated once those
15+
changes are merged.
16+
-->
17+
718
[MODES: framework, data, declarative]
819

920
## Summary
1021

1122
[Reference Documentation ↗](https://api.reactrouter.com/v7/functions/react_router.useNavigate.html)
1223

13-
Returns a function that lets you navigate programmatically in the browser in response to user interactions or effects.
24+
Returns a function that lets you navigate programmatically in the browser in
25+
response to user interactions or effects.
26+
27+
It's often better to use [`redirect`](../utils/redirect) in [`action`](../../start/framework/route-module#action)/[`loader`](../../start/framework/route-module#loader) functions than this hook.
28+
29+
The returned function signature is `navigate(to, options?)/navigate(delta)` where:
30+
31+
* `to` can be a string path, a `To` object, or a number (delta)
32+
* `options` contains options for modifying the navigation
33+
* `flushSync`: Wrap the DOM updates in `ReactDom.flushSync`
34+
* `preventScrollReset`: Do not scroll back to the top of the page after navigation
35+
* `relative`: "route" or "path" to control relative routing logic
36+
* `replace`: Replace the current entry in the history stack
37+
* `state`: Optional history state to include with the new `Location`
38+
* `viewTransition`: Enable `document.startViewTransition` for this navigation
1439

1540
```tsx
1641
import { useNavigate } from "react-router";
1742

1843
function SomeComponent() {
1944
let navigate = useNavigate();
2045
return (
21-
<button
22-
onClick={() => {
23-
navigate(-1);
24-
}}
25-
/>
46+
<button onClick={() => navigate(-1)}>
47+
Go Back
48+
</button>
2649
);
2750
}
2851
```
2952

30-
It's often better to use [redirect](../utils/redirect) in [ActionFunction](https://api.reactrouter.com/v7/interfaces/react_router.ActionFunction.html) and [LoaderFunction](https://api.reactrouter.com/v7/types/react_router.LoaderFunction.html) than this hook.
31-
3253
## Signature
3354

3455
```tsx
35-
navigate(
36-
to: To,
37-
options?: {
38-
flushSync?: boolean;
39-
preventScrollReset?: boolean;
40-
relative?: RelativeRoutingType;
41-
replace?: boolean;
42-
state?: any;
43-
viewTransition?: boolean;
44-
}
45-
): void | Promise<void>;
56+
useNavigate(): NavigateFunction
4657
```
4758

4859
## Examples
4960

50-
### Navigate to another path:
61+
### Navigate to another path
5162

5263
```tsx
5364
navigate("/some/route");
5465
navigate("/some/route?search=param");
5566
```
5667

57-
### Navigate with a `To` object:
68+
### Navigate with a `To` object
5869

5970
All properties are optional.
6071

@@ -69,7 +80,7 @@ navigate({
6980

7081
If you use `state`, that will be available on the `location` object on the next page. Access it with `useLocation().state` (see [useLocation](./useLocation)).
7182

72-
### Navigate back or forward in the history stack:
83+
### Navigate back or forward in the history stack
7384

7485
```tsx
7586
// back
@@ -85,7 +96,7 @@ Be cautions with `navigate(number)`. If your application can load up to a route
8596

8697
Only use this if you're sure they will have an entry in the history stack to navigate to.
8798

88-
### Replace the current entry in the history stack:
99+
### Replace the current entry in the history stack
89100

90101
This will remove the current entry in the history stack, replacing it with a new one, similar to a server side redirect.
91102

@@ -95,7 +106,10 @@ navigate("/some/route", { replace: true });
95106

96107
### Prevent Scroll Reset
97108

98-
[modes: framework, data]
109+
[MODES: framework, data]
110+
111+
<br/>
112+
<br/>
99113

100114
To prevent `<ScrollRestoration>` from resetting the scroll position, use the `preventScrollReset` option.
101115

@@ -104,3 +118,4 @@ navigate("?some-tab=1", { preventScrollReset: true });
104118
```
105119

106120
For example, if you have a tab interface connected to search params in the middle of a page and you don't want it to scroll to the top when a tab is clicked.
121+

docs/api/hooks/useNavigation.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ title: useNavigation
44

55
# useNavigation
66

7+
<!--
8+
⚠️ ⚠️ IMPORTANT ⚠️ ⚠️
9+
10+
Hey! Thank you for helping improve our documentation!
11+
12+
This file is auto-generated from the JSDoc comments in the source
13+
code, so please find the definition of this API and edit the JSDoc
14+
comments accordingly and this file will be re-generated once those
15+
changes are merged.
16+
-->
17+
718
[MODES: framework, data]
819

920
## Summary
@@ -28,3 +39,4 @@ function SomeComponent() {
2839
```tsx
2940
useNavigation(): Navigation
3041
```
42+

0 commit comments

Comments
 (0)