You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* docs: minor typing updates to align with docs
* Add new indicator to fetch utils
* Various other typo fixes and link fixes
* fix up types for scroll restoration matches
* Revert "docs: minor typing updates to align with docs"
This reverts commit e1b52ed.
* Revert "fix up types for scroll restoration matches"
This reverts commit e714bd2.
* Remove duped link
* Remix -> React Router
* Add docs for new 'relative=path' option
Copy file name to clipboardExpand all lines: docs/components/form.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -187,6 +187,10 @@ We've found with `get` you often want the user to be able to click "back" to see
187
187
188
188
In other words, this is really only useful for GET submissions and you want to avoid the back button showing the previous results.
189
189
190
+
## `relative`
191
+
192
+
By default, paths are relative to the route hierarchy, so `..` will go up one `Route` level. Occasionally, you may find that you have matching URL patterns that do not make sense to be nested, and you're prefer to use relative _path_ routing. You can opt into this behavior with `<Form to="../some/where" relative="path">`
193
+
190
194
## `reloadDocument`
191
195
192
196
Instructs the form to skip React Router and submit the form with the browser's built in behavior.
Copy file name to clipboardExpand all lines: docs/components/link.md
+26-2Lines changed: 26 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ title: Link
4
4
5
5
# `<Link>`
6
6
7
-
<docs-info>ZZZ This is the web version of `<Link>`. For the React Native version, [go here][link-native].</docs-info>
7
+
<docs-info>This is the web version of `<Link>`. For the React Native version, [go here][link-native].</docs-info>
8
8
9
9
<details>
10
10
<summary>Type declaration</summary>
@@ -54,7 +54,30 @@ A relative `<Link to>` value (that does not begin with `/`) resolves relative to
54
54
55
55
<docs-info>`<Link to>` with a `..` behaves differently from a normal `<a href>` when the current URL ends with `/`. `<Link to>` ignores the trailing slash, and removes one URL segment for each `..`. But an `<a href>` value handles `..` differently when the current URL ends with `/` vs when it does not.</docs-info>
56
56
57
-
[link-native]: ./link-native
57
+
## `relative`
58
+
59
+
By default, links are relative to the route hierarchy, so `..` will go up one `Route` level. Occasionally, you may find that you have matching URL patterns that do not make sense to be nested, and you're prefer to use relative _path_ routing. You can opt into this behavior with `relative`:
60
+
61
+
```jsx
62
+
// Contact and EditContact do not share additional UI layout
Copy file name to clipboardExpand all lines: docs/getting-started/_data.md
+5-4Lines changed: 5 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,15 +15,15 @@ React Router v6.4 introduces all of the data abstractions from [Remix][remix] fo
15
15
16
16
## Installation
17
17
18
-
The new Data APIs are available on the `next` tag:
18
+
The new Data APIs are available on the `pre` tag:
19
19
20
20
```sh
21
-
npm install react-router-dom@next
21
+
npm install react-router-dom@pre
22
22
```
23
23
24
24
## Configuring Routes
25
25
26
-
Configuring routes is the same, except you need to use [`DataBrowserRouter`][databrowserrouter] to enable the data APIs. note you no longer render `<Routes>` either, just `<Route>`.
26
+
Configuring routes is the same, except you need to use [`DataBrowserRouter`][databrowserrouter] to enable the data APIs. Note you no longer render `<Routes>` either, just `<Route>`.
27
27
28
28
<docs-info>It's important to render `DataBrowserRouter` at the top of the React tree.</docs-info>
29
29
@@ -255,6 +255,7 @@ export default function Root() {
255
255
With the route configured, we can create an [`action`][action]. Actions are like [loaders][loader] except instead "reading" data they "write" data. Think of it like `React.useState`. It returns a reader and a writer. In React Router, loaders are your readers, actions are your writers.
256
256
257
257
```jsx
258
+
// Sample code - this does not actually work :)
258
259
const [reader, writer] =React.useState();
259
260
<Route loader={reader} action={writer} />;
260
261
```
@@ -283,7 +284,7 @@ export default function NewNote() {
Copy file name to clipboardExpand all lines: docs/hooks/use-form-action.md
+15-2Lines changed: 15 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,19 @@ new: true
5
5
6
6
# `useFormAction`
7
7
8
-
This hook is used internally in [Form] to automatically resolve default and relative actions to the current route in context. While uncommon, you can use it directly to do things like compute the correct action for a `<button formAction>` to change the action of the button's `<Form>`. <small>(Yes, HTML buttons can change the action of their form!)</small>
This hook is used internally in [`<Form>`][form] to automatically resolve default and relative actions to the current route in context. While uncommon, you can use it directly to do things like compute the correct action for a `<button formAction>` to change the action of the button's `<Form>`. <small>(Yes, HTML buttons can change the action of their form!)</small>
9
21
10
22
```tsx
11
23
import { useFormAction } from"react-router-dom";
@@ -26,9 +38,10 @@ It's also useful for automatically resolving the action for [`submit`][usesubmit
0 commit comments