Skip to content

Commit 3bce6f0

Browse files
committed
chore: generate markdown docs from jsdocs
1 parent 15e9a9e commit 3bce6f0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+348
-264
lines changed

docs/api/components/Await.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ https://github.com/remix-run/react-router/blob/main/packages/react-router/lib/co
2424

2525
Used to render promise values with automatic error handling.
2626

27-
**Note:** `<Await>` expects to be rendered inside of a `<React.Suspense>`
27+
**Note:** `<Await>` expects to be rendered inside a [`<React.Suspense>`](https://react.dev/reference/react/Suspense)
2828

2929
```tsx
3030
import { Await, useLoaderData } from "react-router";
@@ -97,7 +97,8 @@ function Reviews() {
9797

9898
### errorElement
9999

100-
The error element renders instead of the children when the promise rejects.
100+
The error element renders instead of the `children` when the [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
101+
rejects.
101102

102103
```tsx
103104
<Await
@@ -125,16 +126,18 @@ function ReviewsError() {
125126
}
126127
```
127128

128-
If you do not provide an errorElement, the rejected value will bubble up to
129-
the nearest route-level `ErrorBoundary` and be accessible via the
130-
[`useRouteError`](../hooks/useRouteError) hook.
129+
If you do not provide an `errorElement`, the rejected value will bubble up
130+
to the nearest route-level [`ErrorBoundary`](../../start/framework/route-module#errorboundary)
131+
and be accessible via the [`useRouteError`](../hooks/useRouteError) hook.
131132

132133
### resolve
133134

134-
Takes a promise returned from a `loader` to be resolved and rendered.
135+
Takes a [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
136+
returned from a [`loader`](../../start/framework/route-module#loader) to be
137+
resolved and rendered.
135138

136-
```jsx
137-
import { useLoaderData, Await } from "react-router";
139+
```tsx
140+
import { Await, useLoaderData } from "react-router";
138141
139142
export async function loader() {
140143
let reviews = getReviews(); // not awaited

docs/api/components/Form.md

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,22 @@ https://github.com/remix-run/react-router/blob/main/packages/react-router/lib/do
2222

2323
[Reference Documentation ↗](https://api.reactrouter.com/v7/functions/react_router.Form.html)
2424

25-
A progressively enhanced HTML [`<form>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form) that submits data to actions via `fetch`, activating pending states in `useNavigation` which enables advanced user interfaces beyond a basic HTML form. After a form's action completes, all data on the page is automatically revalidated to keep the UI in sync with the data.
26-
27-
Because it uses the HTML form API, server rendered pages are interactive at a basic level before JavaScript loads. Instead of React Router managing the submission, the browser manages the submission as well as the pending states (like the spinning favicon). After JavaScript loads, React Router takes over enabling web application user experiences.
28-
29-
Form is most useful for submissions that should also change the URL or otherwise add an entry to the browser history stack. For forms that shouldn't manipulate the browser history stack, use [`<fetcher.Form>`][fetcher_form].
25+
A progressively enhanced HTML [`<form>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form)
26+
that submits data to actions via [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API),
27+
activating pending states in [`useNavigation`](../hooks/useNavigation) which enables advanced
28+
user interfaces beyond a basic HTML [`<form>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form).
29+
After a form's `action` completes, all data on the page is automatically
30+
revalidated to keep the UI in sync with the data.
31+
32+
Because it uses the HTML form API, server rendered pages are interactive at a
33+
basic level before JavaScript loads. Instead of React Router managing the
34+
submission, the browser manages the submission as well as the pending states
35+
(like the spinning favicon). After JavaScript loads, React Router takes over
36+
enabling web application user experiences.
37+
38+
`Form` is most useful for submissions that should also change the URL or
39+
otherwise add an entry to the browser history stack. For forms that shouldn't
40+
manipulate the browser history stack, use [`<fetcher.Form>`][fetcher_form].
3041

3142
```tsx
3243
import { Form } from "react-router";
@@ -45,7 +56,7 @@ function NewEvent() {
4556

4657
### action
4758

48-
The URL to submit the form data to. If `undefined`, this defaults to the
59+
The URL to submit the form data to. If `undefined`, this defaults to the
4960
closest route in context.
5061

5162
### discover
@@ -81,8 +92,9 @@ can pick up the fetcher's state in a different component in a [`useFetcher`](../
8192
The HTTP verb to use when the form is submitted. Supports "get", "post",
8293
"put", "delete", and "patch".
8394

84-
Native `<form>` only supports `get` and `post`, avoid the other verbs if
85-
you'd like to support progressive enhancement
95+
Native [`<form>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form)
96+
only supports `get` and `post`, avoid the other verbs if you'd like to
97+
support progressive enhancement
8698

8799
### navigate
88100

@@ -93,39 +105,41 @@ you don't care about the resulting data in this component.
93105
### onSubmit
94106

95107
A function to call when the form is submitted. If you call
96-
`event.preventDefault()` then this form will not do anything.
108+
[`event.preventDefault()`](https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)
109+
then this form will not do anything.
97110

98111
### preventScrollReset
99112

100113
Prevent the scroll position from resetting to the top of the viewport on
101-
completion of the navigation when using the <ScrollRestoration> component
114+
completion of the navigation when using the
115+
``<ScrollRestoration>`` component
102116

103117
### relative
104118

105119
Determines whether the form action is relative to the route hierarchy or
106-
the pathname. Use this if you want to opt out of navigating the route
120+
the pathname. Use this if you want to opt out of navigating the route
107121
hierarchy and want to instead route based on slash-delimited URL segments.
108122
See [`RelativeRoutingType`](https://api.reactrouter.com/v7/types/react_router.RelativeRoutingType.html).
109123

110124
### reloadDocument
111125

112-
Forces a full document navigation instead of client side routing + data
126+
Forces a full document navigation instead of client side routing and data
113127
fetch.
114128

115129
### replace
116130

117-
Replaces the current entry in the browser history stack when the form
118-
navigates. Use this if you don't want the user to be able to click "back"
119-
to the page with the form on it.
131+
Replaces the current entry in the browser [`History`](https://developer.mozilla.org/en-US/docs/Web/API/History)
132+
stack when the form navigates. Use this if you don't want the user to be
133+
able to click "back" to the page with the form on it.
120134

121135
### state
122136

123-
State object to add to the history stack entry for this navigation
137+
State object to add to the [`History`](https://developer.mozilla.org/en-US/docs/Web/API/History)
138+
stack entry for this navigation
124139

125140
### viewTransition
126141

127-
Enables a [View
128-
Transition](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API)
129-
for this navigation. To apply specific styles during the transition see
142+
Enables a [View Transition](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API)
143+
for this navigation. To apply specific styles during the transition, see
130144
[`useViewTransitionState`](../hooks/useViewTransitionState).
131145

docs/api/components/Link.md

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ https://github.com/remix-run/react-router/blob/main/packages/react-router/lib/do
2222

2323
[Reference Documentation ↗](https://api.reactrouter.com/v7/functions/react_router.Link.html)
2424

25-
A progressively enhanced `<a href>` wrapper to enable navigation with client-side routing.
25+
A progressively enhanced [`<a href>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a)
26+
wrapper to enable navigation with client-side routing.
2627

2728
```tsx
2829
import { Link } from "react-router";
@@ -74,8 +75,8 @@ Defines the data and module prefetching behavior for the link.
7475
- **render** - prefetches when the link renders
7576
- **viewport** - prefetches when the link is in the viewport, very useful for mobile
7677

77-
Prefetching is done with HTML `<link rel="prefetch">` tags. They are inserted
78-
after the link.
78+
Prefetching is done with HTML [`<link rel="prefetch">`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link)
79+
tags. They are inserted after the link.
7980

8081
```tsx
8182
<a href="..." />
@@ -93,7 +94,7 @@ Because of this, if you are using `nav :last-child` you will need to use
9394

9495
Prevents the scroll position from being reset to the top of the window when
9596
the link is clicked and the app is using [`ScrollRestoration`](../components/ScrollRestoration). This only
96-
prevents new locations reseting scroll to the top, scroll position will be
97+
prevents new locations resetting scroll to the top, scroll position will be
9798
restored for back/forward button navigation.
9899

99100
```tsx
@@ -112,14 +113,14 @@ Defines the relative path behavior for the link.
112113
<Link relative="path" />
113114
```
114115

115-
Consider a route hierarchy where a parent route pattern is "blog" and a child
116-
route pattern is "blog/:slug/edit".
116+
Consider a route hierarchy where a parent route pattern is `"blog"` and a child
117+
route pattern is `"blog/:slug/edit"`.
117118

118119
- **route** - default, resolves the link relative to the route pattern. In the
119-
example above a relative link of `".."` will remove both `:slug/edit` segments
120-
back to "/blog".
121-
- **path** - relative to the path so `..` will only remove one URL segment up
122-
to "/blog/:slug"
120+
example above, a relative link of `".."` will remove both `:slug/edit` segments
121+
back to `"/blog"`.
122+
- **path** - relative to the path so `".."` will only remove one URL segment up
123+
to `"/blog/:slug"`
123124

124125
Note that index routes and layout routes do not have paths so they are not
125126
included in the relative path calculation.
@@ -129,7 +130,8 @@ included in the relative path calculation.
129130
[modes: framework, data, declarative]
130131

131132
Will use document navigation instead of client side routing when the link is
132-
clicked: the browser will handle the transition normally (as if it were an `<a href>`).
133+
clicked: the browser will handle the transition normally (as if it were an
134+
[`<a href>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a)).
133135

134136
```tsx
135137
<Link to="/logout" reloadDocument />
@@ -139,8 +141,8 @@ clicked: the browser will handle the transition normally (as if it were an `<a h
139141

140142
[modes: framework, data, declarative]
141143

142-
Replaces the current entry in the history stack instead of pushing a new one
143-
onto it.
144+
Replaces the current entry in the [`History`](https://developer.mozilla.org/en-US/docs/Web/API/History)
145+
stack instead of pushing a new one onto it.
144146

145147
```tsx
146148
<Link replace />

docs/api/components/NavLink.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ Can be regular React children or a function that receives an object with the
8080

8181
[modes: framework, data, declarative]
8282

83-
Classes are automatically applied to NavLink that correspond to the state.
83+
Classes are automatically applied to `NavLink` that correspond to the state.
8484

8585
```css
8686
a.active {
@@ -158,8 +158,8 @@ Defines the data and module prefetching behavior for the link.
158158
- **render** - prefetches when the link renders
159159
- **viewport** - prefetches when the link is in the viewport, very useful for mobile
160160

161-
Prefetching is done with HTML `<link rel="prefetch">` tags. They are inserted
162-
after the link.
161+
Prefetching is done with HTML [`<link rel="prefetch">`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link)
162+
tags. They are inserted after the link.
163163

164164
```tsx
165165
<a href="..." />
@@ -177,7 +177,7 @@ Because of this, if you are using `nav :last-child` you will need to use
177177

178178
Prevents the scroll position from being reset to the top of the window when
179179
the link is clicked and the app is using [`ScrollRestoration`](../components/ScrollRestoration). This only
180-
prevents new locations reseting scroll to the top, scroll position will be
180+
prevents new locations resetting scroll to the top, scroll position will be
181181
restored for back/forward button navigation.
182182

183183
```tsx
@@ -196,14 +196,14 @@ Defines the relative path behavior for the link.
196196
<Link relative="path" />
197197
```
198198

199-
Consider a route hierarchy where a parent route pattern is "blog" and a child
200-
route pattern is "blog/:slug/edit".
199+
Consider a route hierarchy where a parent route pattern is `"blog"` and a child
200+
route pattern is `"blog/:slug/edit"`.
201201

202202
- **route** - default, resolves the link relative to the route pattern. In the
203-
example above a relative link of `".."` will remove both `:slug/edit` segments
204-
back to "/blog".
205-
- **path** - relative to the path so `..` will only remove one URL segment up
206-
to "/blog/:slug"
203+
example above, a relative link of `".."` will remove both `:slug/edit` segments
204+
back to `"/blog"`.
205+
- **path** - relative to the path so `".."` will only remove one URL segment up
206+
to `"/blog/:slug"`
207207

208208
Note that index routes and layout routes do not have paths so they are not
209209
included in the relative path calculation.
@@ -213,7 +213,8 @@ included in the relative path calculation.
213213
[modes: framework, data, declarative]
214214

215215
Will use document navigation instead of client side routing when the link is
216-
clicked: the browser will handle the transition normally (as if it were an `<a href>`).
216+
clicked: the browser will handle the transition normally (as if it were an
217+
[`<a href>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a)).
217218

218219
```tsx
219220
<Link to="/logout" reloadDocument />
@@ -223,8 +224,8 @@ clicked: the browser will handle the transition normally (as if it were an `<a h
223224

224225
[modes: framework, data, declarative]
225226

226-
Replaces the current entry in the history stack instead of pushing a new one
227-
onto it.
227+
Replaces the current entry in the [`History`](https://developer.mozilla.org/en-US/docs/Web/API/History)
228+
stack instead of pushing a new one onto it.
228229

229230
```tsx
230231
<Link replace />
@@ -268,7 +269,7 @@ This state is inaccessible on the server as it is implemented on top of
268269
[modes: framework, data, declarative]
269270

270271
Styles can also be applied dynamically via a function that receives
271-
`NavLinkRenderProps` and returns the styles:
272+
[`NavLinkRenderProps`](https://api.reactrouter.com/v7/types/react_router.NavLinkRenderProps.html) and returns the styles:
272273

273274
```tsx
274275
<NavLink to="/tasks" style={{ color: "red" }} />

docs/api/components/Navigate.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ https://github.com/remix-run/react-router/blob/main/packages/react-router/lib/co
2222

2323
[Reference Documentation ↗](https://api.reactrouter.com/v7/functions/react_router.Navigate.html)
2424

25-
A component-based version of [`useNavigate`](../hooks/useNavigate) to use in a [`React.Component
26-
Class`](https://reactjs.org/docs/react-component.html) where hooks are not
27-
able to be used.
25+
A component-based version of [`useNavigate`](../hooks/useNavigate) to use in a
26+
[`React.Component` class](https://react.dev/reference/react/Component) where
27+
hooks cannot be used.
2828

29-
It's recommended to avoid using this component in favor of [`useNavigate`](../hooks/useNavigate)
29+
It's recommended to avoid using this component in favor of [`useNavigate`](../hooks/useNavigate).
3030

3131
```tsx
3232
<Navigate to="/tasks" />
@@ -40,19 +40,21 @@ function Navigate({ to, replace, state, relative }: NavigateProps): null
4040

4141
## Props
4242

43-
### to
43+
### relative
4444

45-
The path to navigate to. This can be a string or an object
45+
How to interpret relative routing in the `to` prop.
46+
See [`RelativeRoutingType`](https://api.reactrouter.com/v7/types/react_router.RelativeRoutingType.html).
4647

4748
### replace
4849

49-
Whether to replace the current entry in the history stack
50+
Whether to replace the current entry in the [`History`](https://developer.mozilla.org/en-US/docs/Web/API/History)
51+
stack
5052

5153
### state
5254

53-
State to pass to the new location to store in [`history.state`](https://developer.mozilla.org/en-US/docs/Web/API/History/state).
55+
State to pass to the new [`Location`](https://api.reactrouter.com/v7/interfaces/react_router.Location.html) to store in [`history.state`](https://developer.mozilla.org/en-US/docs/Web/API/History/state).
5456

55-
### relative
57+
### to
5658

57-
How to interpret relative routing in the `to` prop. See [`RelativeRoutingType`](https://api.reactrouter.com/v7/types/react_router.RelativeRoutingType.html).
59+
The path to navigate to. This can be a string or a [`Path`](https://api.reactrouter.com/v7/interfaces/react_router.Path.html) object
5860

docs/api/components/Outlet.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ https://github.com/remix-run/react-router/blob/main/packages/react-router/lib/co
2222

2323
[Reference Documentation ↗](https://api.reactrouter.com/v7/functions/react_router.Outlet.html)
2424

25-
Renders the matching child route of a parent route or nothing if no child route matches.
25+
Renders the matching child route of a parent route or nothing if no child
26+
route matches.
2627

2728
```tsx
2829
import { Outlet } from "react-router";
@@ -47,7 +48,8 @@ function Outlet(props: OutletProps): React.ReactElement | null
4748

4849
### context
4950

50-
Provides a context value to the element tree below the outlet. Use when the parent route needs to provide values to child routes.
51+
Provides a context value to the element tree below the outlet. Use when
52+
the parent route needs to provide values to child routes.
5153

5254
```tsx
5355
<Outlet context={myContextValue} />

0 commit comments

Comments
 (0)