From 38dc2cf60433ccc62670ef71a66830a294015272 Mon Sep 17 00:00:00 2001
From: Jason Hughes <13565648+chasinhues@users.noreply.github.com>
Date: Wed, 22 Dec 2021 08:11:45 +1000
Subject: [PATCH 01/39] Update typos in concepts.md (#8514)
---
contributors.yml | 1 +
docs/getting-started/concepts.md | 10 +++++-----
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/contributors.yml b/contributors.yml
index 70d633a861..bb52fd0bf5 100644
--- a/contributors.yml
+++ b/contributors.yml
@@ -21,3 +21,4 @@
- timdorr
- turansky
- vijaypushkin
+- chasinhues
diff --git a/docs/getting-started/concepts.md b/docs/getting-started/concepts.md
index a9f03d5189..f7f0686bae 100644
--- a/docs/getting-started/concepts.md
+++ b/docs/getting-started/concepts.md
@@ -228,9 +228,9 @@ React Router takes advantage of this browser feature, abstracts it a bit, and su
You can think about `location.state` just like `location.hash` or `location.search` except instead of putting the values in the [URL](#url) it's hidden--like a super secret piece of the URL only the programmer knows about.
-A couple great use-cases for location state are:
+A couple of great use-cases for location state are:
-- Telling the next page where the user came from and branching the UI. The most popular implementation here is the showing a record in a modal if the user clicked on an item in a grid view, but if they show up to the URL directly, show the record in its own layout (pinterest, old instagram).
+- Telling the next page where the user came from and branching the UI. The most popular implementation here is showing a record in a modal if the user clicked on an item in a grid view, but if they show up to the URL directly, show the record in its own layout (pinterest, old instagram).
- Sending a partial record from a list to the next screen so it can render the partial data immediately and then fetching the rest of the data afterward.
You set location state in two ways: on `` or `navigate`:
@@ -383,7 +383,7 @@ let routes = [
In fact, instead of `` you can use the hook `useRoutes(routesGoHere)` instead. That's all `` is doing.
-As you can see, routes can define a multiple [segments](#segment) like `:teamId/edit`, or just one like `:teamId`. All of the segments down a branch of the [route config](#route-config) are added together to create a final [path pattern](#path-pattern) for a route.
+As you can see, routes can define multiple [segments](#segment) like `:teamId/edit`, or just one like `:teamId`. All of the segments down a branch of the [route config](#route-config) are added together to create a final [path pattern](#path-pattern) for a route.
### Match Params
@@ -625,7 +625,7 @@ Think of it this way, if you're not at one of the child routes' paths, the `` allows the user to change the URL when they click it. React Router will prevent the browser's default behavior and tell the [history](#history) to push a new entry into the [history stack](#history-stack). The [location](#location) changes and the new [matches](#match) will render.
-However, links are accessible in that they
+However, links are accessible in that they:
- Still render a `` so all default accessibility concerns are met (like keyboard, focusability, SEO, etc.)
- Don't prevent the browser's default behavior if it's a right click or command/control click to "open in new tab"
From 7e6d6e8a463d1d5ec650cb24d3c20b1926345da5 Mon Sep 17 00:00:00 2001
From: "remix-cla-bot[bot]"
<92060565+remix-cla-bot[bot]@users.noreply.github.com>
Date: Tue, 21 Dec 2021 22:12:02 +0000
Subject: [PATCH 02/39] chore: sort contributors list
---
contributors.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/contributors.yml b/contributors.yml
index bb52fd0bf5..aedeed1663 100644
--- a/contributors.yml
+++ b/contributors.yml
@@ -1,6 +1,7 @@
- Ajayff4
- brockross
- chaance
+- chasinhues
- elylucas
- hongji00
- JakubDrozd
@@ -21,4 +22,3 @@
- timdorr
- turansky
- vijaypushkin
-- chasinhues
From 1e584b92946ddbe4f5172c621cc07fad1c1736d0 Mon Sep 17 00:00:00 2001
From: atulll <39869656+underager@users.noreply.github.com>
Date: Sun, 26 Dec 2021 10:49:28 +0530
Subject: [PATCH 03/39] Update tutorial.md (#8531)
* Update tutorial.md
referencing `main.jsx` or `index.js` depending on the bundler used.
* Update contributors.yml
Adding underager to contributors.yml
---
contributors.yml | 1 +
docs/getting-started/tutorial.md | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/contributors.yml b/contributors.yml
index aedeed1663..3b9969439d 100644
--- a/contributors.yml
+++ b/contributors.yml
@@ -22,3 +22,4 @@
- timdorr
- turansky
- vijaypushkin
+- underager
diff --git a/docs/getting-started/tutorial.md b/docs/getting-started/tutorial.md
index 8346e72326..19d9bfb958 100644
--- a/docs/getting-started/tutorial.md
+++ b/docs/getting-started/tutorial.md
@@ -170,7 +170,7 @@ export default function Invoices() {
}
```
-Finally, let's teach React Router how to render our app at different URLs by creating our first "Route Config" inside of `main.jsx`.
+Finally, let's teach React Router how to render our app at different URLs by creating our first "Route Config" inside of `main.jsx` or `index.js`.
```tsx lines=[2,4-5,13-19] filename=src/main.jsx
import { render } from "react-dom";
From 6a871338390ead552a01ed523408240fd3c04716 Mon Sep 17 00:00:00 2001
From: "remix-cla-bot[bot]"
<92060565+remix-cla-bot[bot]@users.noreply.github.com>
Date: Sun, 26 Dec 2021 05:19:45 +0000
Subject: [PATCH 04/39] chore: sort contributors list
---
contributors.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/contributors.yml b/contributors.yml
index 3b9969439d..e419763c5d 100644
--- a/contributors.yml
+++ b/contributors.yml
@@ -21,5 +21,5 @@
- thisiskartik
- timdorr
- turansky
-- vijaypushkin
- underager
+- vijaypushkin
From c455e6c9dcff1c06f690d8f3359e764f948481b8 Mon Sep 17 00:00:00 2001
From: Henrikh Kantuni
Date: Mon, 27 Dec 2021 13:41:58 -0500
Subject: [PATCH 05/39] Avoid visiting login page again on back button click
(#8537)
Co-authored-by: Tim Dorr
---
contributors.yml | 1 +
examples/auth/src/App.tsx | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/contributors.yml b/contributors.yml
index e419763c5d..acda578710 100644
--- a/contributors.yml
+++ b/contributors.yml
@@ -23,3 +23,4 @@
- turansky
- underager
- vijaypushkin
+- kantuni
diff --git a/examples/auth/src/App.tsx b/examples/auth/src/App.tsx
index 47e230ee22..ad277f6327 100644
--- a/examples/auth/src/App.tsx
+++ b/examples/auth/src/App.tsx
@@ -136,7 +136,7 @@ function RequireAuth({ children }: { children: JSX.Element }) {
// trying to go to when they were redirected. This allows us to send them
// along to that page after they login, which is a nicer user experience
// than dropping them off on the home page.
- return ;
+ return ;
}
return children;
From 952f267693bc5714dcc73546e0bd8c72d7793c31 Mon Sep 17 00:00:00 2001
From: "remix-cla-bot[bot]"
<92060565+remix-cla-bot[bot]@users.noreply.github.com>
Date: Mon, 27 Dec 2021 18:42:03 +0000
Subject: [PATCH 06/39] chore: sort contributors list
---
contributors.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/contributors.yml b/contributors.yml
index acda578710..87e13a459a 100644
--- a/contributors.yml
+++ b/contributors.yml
@@ -6,6 +6,7 @@
- hongji00
- JakubDrozd
- jonkoops
+- kantuni
- kddnewton
- kentcdodds
- kkirsche
@@ -23,4 +24,3 @@
- turansky
- underager
- vijaypushkin
-- kantuni
From 4f18028d06363070aa811a63801d79e2ed11f897 Mon Sep 17 00:00:00 2001
From: Arjaan Buijk <16159200+ArjaanBuijk@users.noreply.github.com>
Date: Mon, 27 Dec 2021 13:54:42 -0500
Subject: [PATCH 07/39] Change extension of 'src/routes/invoice.js' to 'jsx'
(#8536)
---
docs/getting-started/tutorial.md | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/docs/getting-started/tutorial.md b/docs/getting-started/tutorial.md
index 19d9bfb958..d2eae1530f 100644
--- a/docs/getting-started/tutorial.md
+++ b/docs/getting-started/tutorial.md
@@ -376,9 +376,9 @@ The `"*"` has special meaning here. It will match only when no other routes do.
## Reading URL Params
-Alright, back to the individual invoice URLs. Let's add a route for a specific invoice. We just visited some URLs like `"/invoices/1998"` and `"/invoices/2005"`, let's make a new component at `src/routes/invoice.js` to render at those URLs:
+Alright, back to the individual invoice URLs. Let's add a route for a specific invoice. We just visited some URLs like `"/invoices/1998"` and `"/invoices/2005"`, let's make a new component at `src/routes/invoice.jsx` to render at those URLs:
-```js filename=src/routes/invoice.js
+```js filename=src/routes/invoice.jsx
export default function Invoice() {
return Invoice #???
;
}
@@ -450,7 +450,7 @@ export default function Invoices() {
Okay, let's close the circle here. Open up the invoice component again and let's get the `:invoiceId` param from the URL:
-```ts lines=[1,4] filename=src/routes/invoice.js
+```ts lines=[1,4] filename=src/routes/invoice.jsx
import { useParams } from "react-router-dom";
export default function Invoice() {
@@ -481,9 +481,9 @@ export function getInvoice(number) {
}
```
-And now back in `invoice.js` we use the param to look up an invoice and display more information:
+And now back in `invoice.jsx` we use the param to look up an invoice and display more information:
-```js filename=routes/invoice.js lines=[2,6]
+```js filename=routes/invoice.jsx lines=[2,6]
import { useParams } from "react-router-dom";
import { getInvoice } from "../data";
From 1cf5f7e938ea4d5cff23ce88f9f952f0a343b7a0 Mon Sep 17 00:00:00 2001
From: Tim Dorr
Date: Tue, 28 Dec 2021 20:21:38 -0500
Subject: [PATCH 08/39] Remove history install
---
docs/getting-started/tutorial.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/getting-started/tutorial.md b/docs/getting-started/tutorial.md
index d2eae1530f..91d215b415 100644
--- a/docs/getting-started/tutorial.md
+++ b/docs/getting-started/tutorial.md
@@ -53,7 +53,7 @@ Then install React Router dependencies:
```sh
cd router-tutorial
-npm install react-router-dom@6 history@5
+npm install react-router-dom@6
```
Then edit your App.js to be pretty boring:
From 48b7c60a2133a617d64533b54eb299dbd2d1be0e Mon Sep 17 00:00:00 2001
From: Jan Margeta
Date: Fri, 31 Dec 2021 02:21:16 +0100
Subject: [PATCH 09/39] Fix minor typos in the "Matching generally static
values" FAQ example (#8548)
---
contributors.yml | 1 +
docs/faq.md | 6 +++---
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/contributors.yml b/contributors.yml
index 87e13a459a..25ce100267 100644
--- a/contributors.yml
+++ b/contributors.yml
@@ -5,6 +5,7 @@
- elylucas
- hongji00
- JakubDrozd
+- jmargeta
- jonkoops
- kantuni
- kddnewton
diff --git a/docs/faq.md b/docs/faq.md
index da420e9a22..c5eda8f203 100644
--- a/docs/faq.md
+++ b/docs/faq.md
@@ -296,9 +296,9 @@ These are all actually just static paths, so in v6 you can make three routes and
function App() {
return (
- } />
- } />
- } />
+ } />
+ } />
+ } />
);
}
From 02fcd50ba6829972bc42b140f90a63443dfbd27e Mon Sep 17 00:00:00 2001
From: Logan McAnsh
Date: Tue, 4 Jan 2022 13:00:10 -0500
Subject: [PATCH 10/39] chore: create CLA (#8557)
totally forgot to do this when I added the bot...
---
CLA.md | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
create mode 100644 CLA.md
diff --git a/CLA.md b/CLA.md
new file mode 100644
index 0000000000..ab2a787541
--- /dev/null
+++ b/CLA.md
@@ -0,0 +1,23 @@
+Remix Software, Inc. Individual Contributor License Agreement ("Agreement"), v2.0
+
+You accept and agree to the following terms and conditions for Your present and future Contributions submitted to Remix Software, Inc. ("Remix"). Except for the license granted herein to Remix and recipients of software distributed by Remix, You reserve all right, title, and interest in and to Your Contributions.
+
+1. Definitions.
+
+"You" (or "Your") shall mean the copyright owner or legal entity authorized by the copyright owner that is making this Agreement with Remix. For legal entities, the entity making a Contribution and all other entities that control, are controlled by, or are under common control with that entity are considered to be a single Contributor. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+"Contribution" shall mean any original work of authorship, including any modifications or additions to an existing work, that is intentionally submitted by You to Remix for inclusion in, or documentation of, any of the products owned or managed by Remix (the "Work"). For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to Remix or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, Remix for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by You as "Not a Contribution."
+
+2. Grant of Copyright License. Subject to the terms and conditions of this Agreement, You hereby grant to Remix and to recipients of software distributed by Remix a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute Your Contributions and such derivative works.
+
+3. Grant of Patent License. Subject to the terms and conditions of this Agreement, You hereby grant to Remix and to recipients of software distributed by Remix a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by You that are necessarily infringed by Your Contribution(s) alone or by combination of Your Contribution(s) with the Work to which such Contribution(s) was submitted. If any entity institutes patent litigation against You or any other entity (including a cross-claim or counterclaim in a lawsuit) alleging that your Contribution, or the Work to which you have contributed, constitutes direct or contributory patent infringement, then any patent licenses granted to that entity under this Agreement for that Contribution or Work shall terminate as of the date such litigation is filed.
+
+4. You represent that you are legally entitled to grant the above license. If your employer(s) has rights to intellectual property that you create that includes your Contributions, you represent that you have received permission to make Contributions on behalf of that employer, that your employer has waived such rights for your Contributions to Remix, or that your employer has executed a separate Corporate CLA with Remix.
+
+5. You represent that each of Your Contributions is Your original creation (see section 7 for submissions on behalf of others). You represent that Your Contribution submissions include complete details of any third-party license or other restriction (including, but not limited to, related patents and trademarks) of which you are personally aware and which are associated with any part of Your Contributions.
+
+6. You are not expected to provide support for Your Contributions, except to the extent You desire to provide support. You may provide support for free, for a fee, or not at all. Unless required by applicable law or agreed to in writing, You provide Your Contributions on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON- INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE.
+
+7. Should You wish to submit work that is not Your original creation, You may submit it to Remix separately from any Contribution, identifying the complete details of its source and of any license or other restriction (including, but not limited to, related patents, trademarks, and license agreements) of which you are personally aware, and conspicuously marking the work as "Submitted on behalf of a third-party: [named here]".
+
+8. You agree to notify Remix of any facts or circumstances of which you become aware that would make these representations inaccurate in any respect.
From 9bdf8aea2643b2b743901872c193c29f11c0fd7c Mon Sep 17 00:00:00 2001
From: koojaa <53225921+koojaa@users.noreply.github.com>
Date: Wed, 5 Jan 2022 07:40:19 +0900
Subject: [PATCH 11/39] fix: Modify return type of className of NavLinkProps
interface (#8542)
`className` may be undefined
---
contributors.yml | 1 +
docs/api.md | 2 +-
.../__tests__/nav-link-active-test.tsx | 29 +++++++++++++++++++
packages/react-router-dom/index.tsx | 4 +--
4 files changed, 33 insertions(+), 3 deletions(-)
diff --git a/contributors.yml b/contributors.yml
index 25ce100267..c363337c0d 100644
--- a/contributors.yml
+++ b/contributors.yml
@@ -25,3 +25,4 @@
- turansky
- underager
- vijaypushkin
+- koojaa
diff --git a/docs/api.md b/docs/api.md
index 056850b49c..1f05f95993 100644
--- a/docs/api.md
+++ b/docs/api.md
@@ -355,7 +355,7 @@ interface NavLinkProps
| ((props: { isActive: boolean }) => React.ReactNode);
className?:
| string
- | ((props: { isActive: boolean }) => string);
+ | ((props: { isActive: boolean }) => string | undefined);
end?: boolean;
style?:
| React.CSSProperties
diff --git a/packages/react-router-dom/__tests__/nav-link-active-test.tsx b/packages/react-router-dom/__tests__/nav-link-active-test.tsx
index 6f926536b1..458ba92d2c 100644
--- a/packages/react-router-dom/__tests__/nav-link-active-test.tsx
+++ b/packages/react-router-dom/__tests__/nav-link-active-test.tsx
@@ -44,6 +44,35 @@ describe("NavLink", () => {
expect(anchor.children[0]).toMatch("Somewhere else");
});
+
+ it("applies an 'undefined' className to the underlying ", () => {
+ let renderer: TestRenderer.ReactTestRenderer;
+ TestRenderer.act(() => {
+ renderer = TestRenderer.create(
+
+
+
+ isActive ? "some-active-classname" : undefined
+ }
+ >
+ Home
+
+ }
+ />
+
+
+ );
+ });
+
+ let anchor = renderer.root.findByType("a");
+
+ expect(anchor.props.className).toBeUndefined();
+ });
});
describe("when it matches to the end", () => {
diff --git a/packages/react-router-dom/index.tsx b/packages/react-router-dom/index.tsx
index 4c6041027b..40cbe72d2f 100644
--- a/packages/react-router-dom/index.tsx
+++ b/packages/react-router-dom/index.tsx
@@ -287,7 +287,7 @@ export interface NavLinkProps
| React.ReactNode
| ((props: { isActive: boolean }) => React.ReactNode);
caseSensitive?: boolean;
- className?: string | ((props: { isActive: boolean }) => string);
+ className?: string | ((props: { isActive: boolean }) => string | undefined);
end?: boolean;
style?:
| React.CSSProperties
@@ -329,7 +329,7 @@ export const NavLink = React.forwardRef(
let ariaCurrent = isActive ? ariaCurrentProp : undefined;
- let className: string;
+ let className: string | undefined;
if (typeof classNameProp === "function") {
className = classNameProp({ isActive });
} else {
From d32662ddd67d489a46171b450ec933a0ce88d346 Mon Sep 17 00:00:00 2001
From: "remix-cla-bot[bot]"
<92060565+remix-cla-bot[bot]@users.noreply.github.com>
Date: Tue, 4 Jan 2022 22:40:35 +0000
Subject: [PATCH 12/39] chore: sort contributors list
---
contributors.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/contributors.yml b/contributors.yml
index c363337c0d..b461e8d886 100644
--- a/contributors.yml
+++ b/contributors.yml
@@ -11,6 +11,7 @@
- kddnewton
- kentcdodds
- kkirsche
+- koojaa
- liuhanqu
- markivancho
- mcansh
@@ -25,4 +26,3 @@
- turansky
- underager
- vijaypushkin
-- koojaa
From abbea846b8cccc30b62aa7da9d13f3fabff6f980 Mon Sep 17 00:00:00 2001
From: Remix Run Bot
Date: Tue, 4 Jan 2022 22:41:30 +0000
Subject: [PATCH 13/39] chore: format
formatted d32662ddd67d489a46171b450ec933a0ce88d346
---
docs/api.md | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/docs/api.md b/docs/api.md
index 1f05f95993..bb87767162 100644
--- a/docs/api.md
+++ b/docs/api.md
@@ -355,7 +355,9 @@ interface NavLinkProps
| ((props: { isActive: boolean }) => React.ReactNode);
className?:
| string
- | ((props: { isActive: boolean }) => string | undefined);
+ | ((props: {
+ isActive: boolean;
+ }) => string | undefined);
end?: boolean;
style?:
| React.CSSProperties
From e3f1a29b09c5265632413d991b5540487862785c Mon Sep 17 00:00:00 2001
From: Chris Chudzicki
Date: Sat, 15 Jan 2022 21:23:17 -0500
Subject: [PATCH 14/39] fix(tutorial): use "root" as root div id (#8582)
---
contributors.yml | 1 +
tutorial/index.html | 2 +-
tutorial/src/main.jsx | 2 +-
3 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/contributors.yml b/contributors.yml
index b461e8d886..5b6e727522 100644
--- a/contributors.yml
+++ b/contributors.yml
@@ -2,6 +2,7 @@
- brockross
- chaance
- chasinhues
+- christopherchudzicki
- elylucas
- hongji00
- JakubDrozd
diff --git a/tutorial/index.html b/tutorial/index.html
index 3e91e89f3d..bb0aca7e07 100644
--- a/tutorial/index.html
+++ b/tutorial/index.html
@@ -6,7 +6,7 @@
React Router - Tutorial
-
+