Skip to content

Commit 097a6b4

Browse files
committed
Merge branch 'dev' into changesets
2 parents 64d3634 + 72b1345 commit 097a6b4

35 files changed

+1915
-423
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ node_modules/
1313
/packages/*/esm/
1414
/packages/*/umd/
1515

16-
# v6+ build files
16+
# v6 build files
1717
/build/
1818
/packages/*/dist/
1919
/packages/*/LICENSE.md

contributors.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,4 @@
7070
- vijaypushkin
7171
- vikingviolinist
7272
- williamsdyyz
73+
- xavier-lc

docs/components/link-native.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@ title: Link (RN)
44

55
# `<Link>` (React Native)
66

7-
> **Note:**
8-
>
9-
> This is the React Native version of `<Link>`. For the web version,
10-
> [go here][link].
7+
<docs-info>This is the React Native version of `<Link>`. For the web version, [go here][link].</docs-info>
118

129
<details>
1310
<summary>Type declaration</summary>

docs/components/link.md

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@ title: Link
44

55
# `<Link>`
66

7-
> **Note:**
8-
>
9-
> This is the web version of `<Link>`. For the React Native version,
10-
> [go here][link-native].
7+
<docs-info>ZZZ This is the web version of `<Link>`. For the React Native version, [go here][link-native].</docs-info>
118

129
<details>
1310
<summary>Type declaration</summary>
@@ -55,12 +52,7 @@ function UsersIndexPage({ users }) {
5552

5653
A relative `<Link to>` value (that does not begin with `/`) resolves relative to the parent route, which means that it builds upon the URL path that was matched by the route that rendered that `<Link>`. It may contain `..` to link to routes further up the hierarchy. In these cases, `..` works exactly like the command-line `cd` function; each `..` removes one segment of the parent path.
5754

58-
> **Note:**
59-
>
60-
> `<Link to>` with a `..` behaves differently from a normal `<a href>` when the
61-
> current URL ends with `/`. `<Link to>` ignores the trailing slash, and removes
62-
> one URL segment for each `..`. But an `<a href>` value handles `..`
63-
> differently when the current URL ends with `/` vs when it does not.
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>
6456

6557
[link-native]: ./link-native
6658

docs/components/navigate.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,7 @@ interface NavigateProps {
2121

2222
A `<Navigate>` element changes the current location when it is rendered. It's a component wrapper around [`useNavigate`][use-navigate], and accepts all the same arguments as props.
2323

24-
> **Note:**
25-
>
26-
> Having a component-based version of the `useNavigate` hook makes it easier to
27-
> use this feature in a [`React.Component`](https://reactjs.org/docs/react-component.html)
28-
> subclass where hooks are not able to be used.
24+
<docs-info>Having a component-based version of the `useNavigate` hook makes it easier to use this feature in a [`React.Component`](https://reactjs.org/docs/react-component.html) subclass where hooks are not able to be used.</docs-info>
2925

3026
```tsx
3127
import * as React from "react";

docs/elements.md

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
---
2+
title: Markdown Elements
3+
hidden: true
4+
---
5+
6+
# Markdown Elements
7+
8+
This is for testing all the different kinds of markdown that can exist. Whenever I find a styling edge case that exists, I add it to this document. It’s my form of visual regression for all the different kinds of elements that need to be styled across different contexts.
9+
10+
## Headings
11+
12+
For headings, do we ever go deeper than a heading 4? Do we really need styles for that?
13+
14+
## Heading 2
15+
16+
### Heading 3
17+
18+
#### Heading 4
19+
20+
##### Heading 5
21+
22+
###### Heading 6
23+
24+
## Callouts
25+
26+
Callouts can be used with the `<docs-*>` elements. They are specifically for calling special attention to pieces of information outside the normal flow of the document.
27+
28+
There are three supported variations of these elements:
29+
30+
1. `<docs-info>` - For general callouts to bits of information.
31+
2. `<docs-warning>` - For warning the read about something they should know.
32+
3. `<docs-error>` - For telling the user they shouldn’t be doing something.
33+
34+
Examples:
35+
36+
<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>
37+
38+
<docs-warning>`useMatches` only works with Data Routers, since they know the full route tree up front and can provide all of the current matches. Additionally, `useMatches` will not match down into any descendant route trees since the router isn't aware of the descendant routes.</docs-warning>
39+
40+
<docs-error>Do not do this</docs-error>
41+
42+
<docs-info>The markup for this is kind of ugly, because (currently) these all have to be inside the `<docs-*>` element without any line breaks _but_ it is possible there could be an image inside these. <img src="https://picsum.photos/480/270" width="480" height="270" /></docs-info>
43+
44+
Note: maybe the semantics for these aren't quite right. There might be other nouns that make sense in the case of docs, like:
45+
46+
- `<docs-info>` could become `<docs-tip>`
47+
- `<docs-warning>` could become `<docs-important>`
48+
- `<docs-error>` could become `<docs-warning>` or `<docs-danger>`
49+
50+
## Normal Prose
51+
52+
@TODO Blockquotes, lists, etc.
53+
54+
This is a `<blockquote>` with multiple lines in it:
55+
56+
> This is my quote.
57+
>
58+
> It can have [links]($link), **bold text**, _italic text_, and even `<code>`, all of which should be accounted for. Oh, and don't forget lists:
59+
>
60+
> - List item 1
61+
> - List item 2
62+
> - List item 3
63+
>
64+
> Unordered, or ordered:
65+
>
66+
> 1. List item
67+
> 2. Another list item
68+
> 3. Yet another list item
69+
70+
This is a list of links, some of which are code:
71+
72+
- This is my first list item
73+
- [This is my second list item that’s a link][$link]
74+
- This is my third item that has `<code>` and [`<LinkedCode>` mixed with text][$link]
75+
76+
And don't forget about proper styling for `<a>` tags that don’t have an `href`: <a>like this link right here</a>.
77+
78+
## Code
79+
80+
Normal code:
81+
82+
```tsx
83+
<DataBrowserRouter initialEntries={["/events/123"]}>
84+
<Route path="/" element={<Root />} loader={rootLoader}>
85+
<Route
86+
path="events/:id"
87+
element={<Event />}
88+
loader={eventLoader}
89+
/>
90+
</Route>
91+
</DataBrowserRouter>
92+
```
93+
94+
With multiple highlighted lines:
95+
96+
```tsx lines=[1-2,5]
97+
<DataBrowserRouter initialEntries={["/events/123"]}>
98+
<Route path="/" element={<Root />} loader={rootLoader}>
99+
<Route
100+
path="events/:id"
101+
element={<Event />}
102+
loader={eventLoader}
103+
/>
104+
</Route>
105+
</DataBrowserRouter>
106+
```
107+
108+
With a filename:
109+
110+
```tsx filename=src/main.jsx
111+
<DataBrowserRouter initialEntries={["/events/123"]}>
112+
<Route path="/" element={<Root />} loader={rootLoader}>
113+
<Route
114+
path="events/:id"
115+
element={<Event />}
116+
loader={eventLoader}
117+
/>
118+
</Route>
119+
</DataBrowserRouter>
120+
```
121+
122+
Bad code with highlighted lines:
123+
124+
```tsx bad lines=[2-5]
125+
<DataBrowserRouter initialEntries={["/events/123"]}>
126+
<Routes>
127+
<Route path="/" element={<Root />} loader={rootLoader}>
128+
<Route
129+
path="events/:id"
130+
element={<Event />}
131+
loader={eventLoader}
132+
/>
133+
</Route>
134+
</Routes>
135+
</DataBrowserRouter>
136+
```
137+
138+
Lines that overflow:
139+
140+
```html
141+
<!-- Other HTML for your app goes here -->
142+
<!-- prettier-ignore -->
143+
<script src="https://unpkg.com/react@>=16.8/umd/react.development.js" crossorigin></script>
144+
```
145+
146+
---
147+
148+
[$link]: https://www.youtube.com/watch?v=dQw4w9WgXcQ

docs/getting-started/data.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,4 +401,4 @@ Good luck!
401401
[loader]: ../route/loader
402402
[formdata]: https://developer.mozilla.org/en-US/docs/Web/API/FormData
403403
[request]: https://developer.mozilla.org/en-US/docs/Web/API/Request
404-
[demo]: https://stackblitz.com/github/remix-run/react-router/tree/remixing/examples/notes?file=src%2Fmain.jsx
404+
[demo]: https://stackblitz.com/github/remix-run/react-router/tree/dev/examples/notes?file=src%2Fmain.jsx

docs/guides/contributing.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ If you need a bug fixed and nobody is fixing it, your best bet is to provide a f
5050

5151
Pull requests need only the approval of two or more collaborators to be merged; when the PR author is a collaborator, that counts as one.
5252

53-
> **Important:** When creating the PR in GitHub, make sure that you set the base to the correct branch. If you are submitting a PR that touches any code, this should be the `dev` branch. You set the base in GitHub when authoring the PR with the dropdown below the "Compare changes" heading:
54-
>
55-
> <img src="https://raw.githubusercontent.com/remix-run/react-router/main/static/base-branch.png" alt="" width="460" height="350" />
53+
<docs-warning>When creating the PR in GitHub, make sure that you set the base to the correct branch. If you are submitting a PR that touches any code, this should be the `dev` branch. You set the base in GitHub when authoring the PR with the dropdown below the "Compare changes" heading: <img src="https://raw.githubusercontent.com/remix-run/react-router/main/static/base-branch.png" alt="" width="460" height="350" /></docs-warning>
5654

5755
### Tests
5856

docs/hooks/use-fetcher.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ new: true
55

66
# `useFetcher`
77

8-
In HTML/HTTP, data mutations and loads are modeled with navigation: `<a href>` and `<form action>`. Both cause a navigation in the browser. The React Router equivalents are `<Link>` and `<Form>`.
8+
In HTML/HTTP, data mutations and loads are modeled with navigation: `<a href>` and `<form action>`. Both cause a navigation in the browser. The React Router equivalents are [`<Link>`][link] and [`<Form>`][form].
99

1010
But sometimes you want to call a loader outside of navigation, or call an action (and get the data on the page to revalidate) without changing the URL. Or you need to have multiple mutations in-flight at the same time.
1111

@@ -61,8 +61,8 @@ Fetchers have a lot of built-in behavior:
6161
You can know the state of the fetcher with `fetcher.state`. It will be one of:
6262

6363
- **idle** - nothing is being fetched.
64-
- **submitting** - A form has been submitted. If the method is GET, then the route loader is being called. If POST, PUT, PATCH, or DELETE, then the route action is being called.
65-
- **loading** - The data on the page is being revalidated after an action submission
64+
- **submitting** - A route action is being called due to a fetcher submission using POST, PUT, PATCH, or DELETE
65+
- **loading** - The fetcher is calling a loader (from a `fetcher.load`) or the route data on the page is being revalidated after a fetcher submission
6666

6767
## `fetcher.Form`
6868

@@ -103,6 +103,8 @@ Although a URL might match multiple nested routes, a `fetcher.load()` call will
103103

104104
If you find yourself calling this function inside of click handlers, you can probably simplify your code by using `<fetcher.Form>` instead.
105105

106+
<docs-info>Any `fetcher.load` calls that are active on the page will be re-executed as part of revalidation (either after a navigation submission, another fetcher submission, or a `useRevalidator()` call)</docs-info>
107+
106108
## `fetcher.submit()`
107109

108110
The imperative version of `<fetcher.Form>`. If a user interaction should initiate the fetch, you should use `<fetcher.Form>`. But if you, the programmer are initiating the fetch (not in response to a user clicking a button, etc.), then use this function.
@@ -217,3 +219,6 @@ Tells you the method of the form being submitted: get, post, put, patch, or dele
217219
// when the form is submitting
218220
fetcher.formMethod; // "post"
219221
```
222+
223+
[link]: ../components/link
224+
[form]: ../components/form

docs/hooks/use-search-params-rn.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@ title: useSearchParams (RN)
44

55
# `useSearchParams` (React Native)
66

7-
> **Note:**
8-
>
9-
> This is the React Native version of `useSearchParams`. For the web version,
10-
> [go here][usesearchparams].
7+
<docs-info>This is the React Native version of `useSearchParams`. For the web version, [go here][usesearchparams].</docs-info>
118

129
<details>
1310
<summary>Type declaration</summary>

0 commit comments

Comments
 (0)