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 -
+
diff --git a/tutorial/src/main.jsx b/tutorial/src/main.jsx index 514b32507b..8a3cadb896 100644 --- a/tutorial/src/main.jsx +++ b/tutorial/src/main.jsx @@ -3,5 +3,5 @@ import * as ReactDOM from "react-dom"; import App from "./App"; import "./main.css"; -let rootElement = document.getElementById("app"); +let rootElement = document.getElementById("root"); ReactDOM.render(, rootElement); From 1d2c24e0f00f361d51deac58977966a3ad4504be Mon Sep 17 00:00:00 2001 From: Drew Reese Date: Thu, 20 Jan 2022 08:19:00 -0800 Subject: [PATCH 15/39] Update faq.md (#8596) * Update faq.md Example `Route` component from a v6 example was still using a `component` prop and component reference vs `element` prop and JSX. * Update contributors.yml --- contributors.yml | 1 + docs/faq.md | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/contributors.yml b/contributors.yml index 5b6e727522..5403764077 100644 --- a/contributors.yml +++ b/contributors.yml @@ -1,4 +1,5 @@ - Ajayff4 +- awreese - brockross - chaance - chasinhues diff --git a/docs/faq.md b/docs/faq.md index c5eda8f203..9d3ff9fad1 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -335,7 +335,7 @@ function App() { return ( } /> - + } /> ); } From 41584bc8d83817f2f2836bf2761755e7715bf186 Mon Sep 17 00:00:00 2001 From: taisei mima Date: Sat, 22 Jan 2022 01:19:21 +0900 Subject: [PATCH 16/39] docs: Fix types related to history State (#8601) --- contributors.yml | 1 + docs/api.md | 51 ++++++++++++++++++++++-------------------------- 2 files changed, 24 insertions(+), 28 deletions(-) diff --git a/contributors.yml b/contributors.yml index 5403764077..93884ebc73 100644 --- a/contributors.yml +++ b/contributors.yml @@ -28,3 +28,4 @@ - turansky - underager - vijaypushkin +- bhbs diff --git a/docs/api.md b/docs/api.md index bb87767162..163a2cd65b 100644 --- a/docs/api.md +++ b/docs/api.md @@ -310,7 +310,7 @@ interface LinkProps extends TouchableHighlightProps { children?: React.ReactNode; onPress?(event: GestureResponderEvent): void; replace?: boolean; - state?: State; + state?: any; to: To; } ``` @@ -475,7 +475,7 @@ declare function Navigate(props: NavigateProps): null; interface NavigateProps { to: To; replace?: boolean; - state?: State; + state?: any; } ``` @@ -831,7 +831,7 @@ The term "location" in React Router refers to [the `Location` interface](https:/ > > The `history` package is React Router's only dependency and many of the > core types in React Router come directly from that library including -> `Location`, `To`, `Path`, `State`, and others. You can read more about +> `Location`, `To`, `Path`, and others. You can read more about > the history library in [its documentation](https://github.com/remix-run/history/tree/main/docs). ### `matchRoutes` @@ -957,15 +957,12 @@ The `useHref` hook returns a URL that may be used to link to the given `to` loca Type declaration ```tsx -declare function useLinkClickHandler< - E extends Element = HTMLAnchorElement, - S extends State = State ->( +declare function useLinkClickHandler( to: To, options?: { target?: React.HTMLAttributeAnchorTarget; replace?: boolean; - state?: S; + state?: any; } ): (event: React.MouseEvent) => void; ``` @@ -1025,13 +1022,11 @@ const Link = React.forwardRef( Type declaration ```tsx -declare function useLinkPressHandler< - S extends State = State ->( +declare function useLinkPressHandler( to: To, options?: { replace?: boolean; - state?: S; + state?: any; } ): (event: GestureResponderEvent) => void; ``` @@ -1091,9 +1086,8 @@ The `useInRouterContext` hooks returns `true` if the component is being rendered ```tsx declare function useLocation(): Location; -interface Location - extends Path { - state: S; +interface Location extends Path { + state: unknown; key: Key; } ``` @@ -1315,7 +1309,7 @@ function App() { ```tsx declare function useSearchParams( defaultInit?: URLSearchParamsInit -): [URLSearchParams, URLSearchParamsSetter]; +): [URLSearchParams, SetURLSearchParams]; type ParamKeyValuePair = [string, string]; @@ -1325,12 +1319,10 @@ type URLSearchParamsInit = | Record | URLSearchParams; -interface URLSearchParamsSetter { - ( - nextInit: URLSearchParamsInit, - navigateOptions?: { replace?: boolean; state?: State } - ): void; -} +type SetURLSearchParams = ( + nextInit?: URLSearchParamsInit, + navigateOpts?: : { replace?: boolean; state?: any } +) => void; ``` @@ -1381,7 +1373,7 @@ function App() { ```tsx declare function useSearchParams( defaultInit?: URLSearchParamsInit -): [URLSearchParams, URLSearchParamsSetter]; +): [URLSearchParams, SetURLSearchParams]; type ParamKeyValuePair = [string, string]; @@ -1391,11 +1383,14 @@ type URLSearchParamsInit = | Record | URLSearchParams; -interface URLSearchParamsSetter { - ( - nextInit: URLSearchParamsInit, - navigateOptions?: { replace?: boolean; state?: State } - ): void; +type SetURLSearchParams = ( + nextInit?: URLSearchParamsInit, + navigateOpts?: : NavigateOptions +) => void; + +interface NavigateOptions { + replace?: boolean; + state?: any; } ``` From c3bd01e69094d54313d342b258f7dcd380ea85ae Mon Sep 17 00:00:00 2001 From: "remix-cla-bot[bot]" <92060565+remix-cla-bot[bot]@users.noreply.github.com> Date: Fri, 21 Jan 2022 16:19:35 +0000 Subject: [PATCH 17/39] chore: sort contributors list --- contributors.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contributors.yml b/contributors.yml index 93884ebc73..305cb72225 100644 --- a/contributors.yml +++ b/contributors.yml @@ -1,5 +1,6 @@ - Ajayff4 - awreese +- bhbs - brockross - chaance - chasinhues @@ -28,4 +29,3 @@ - turansky - underager - vijaypushkin -- bhbs From df1f77a2cb95f8884576e9abaa8357a3077326cf Mon Sep 17 00:00:00 2001 From: Remix Run Bot Date: Fri, 21 Jan 2022 16:20:43 +0000 Subject: [PATCH 18/39] chore: format formatted c3bd01e69094d54313d342b258f7dcd380ea85ae --- docs/api.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/api.md b/docs/api.md index 163a2cd65b..b9c41d1280 100644 --- a/docs/api.md +++ b/docs/api.md @@ -957,7 +957,9 @@ The `useHref` hook returns a URL that may be used to link to the given `to` loca Type declaration ```tsx -declare function useLinkClickHandler( +declare function useLinkClickHandler< + E extends Element = HTMLAnchorElement +>( to: To, options?: { target?: React.HTMLAttributeAnchorTarget; From 0f12ceadb3ae33799f47c898a0877aab63176c6f Mon Sep 17 00:00:00 2001 From: Tim Dorr Date: Tue, 25 Jan 2022 20:33:24 -0500 Subject: [PATCH 19/39] Fix change highlights Fixes #8618 --- 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 91d215b415..4a8032af5c 100644 --- a/docs/getting-started/tutorial.md +++ b/docs/getting-started/tutorial.md @@ -114,7 +114,7 @@ Nothing changes in your app, but now we're ready to start messing with the URL. Open up `src/App.js`, import `Link` and add some global navigation. Side note: don't take the styling too seriously in this tutorial, we're just using inline styles for convenience, style your apps however you want. -```tsx lines=[1,7-9] filename=src/App.js +```tsx lines=[1,7-15] filename=src/App.js import { Link } from "react-router-dom"; export default function App() { From 8221d14d2346bac86fe4f0148a2964ff6c88d8f3 Mon Sep 17 00:00:00 2001 From: lukerSpringTree Date: Thu, 27 Jan 2022 00:37:15 +0800 Subject: [PATCH 20/39] fix(examples): there is an error in example (#8619) Co-authored-by: jianglin --- contributors.yml | 1 + examples/custom-query-parsing/src/App.tsx | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/contributors.yml b/contributors.yml index 305cb72225..c59064a4c3 100644 --- a/contributors.yml +++ b/contributors.yml @@ -29,3 +29,4 @@ - turansky - underager - vijaypushkin +- lukerSpringTree diff --git a/examples/custom-query-parsing/src/App.tsx b/examples/custom-query-parsing/src/App.tsx index 1230aa865d..56cf8c5f41 100644 --- a/examples/custom-query-parsing/src/App.tsx +++ b/examples/custom-query-parsing/src/App.tsx @@ -152,7 +152,7 @@ function Home() { type="radio" name="crust" value="deep-dish" - defaultChecked={pizza.crust === "dish-dish"} + defaultChecked={pizza.crust === "deep-dish"} />{" "} Deep Dish From 5dc07e20e38ecda14b6f6918998a62aa42416fe2 Mon Sep 17 00:00:00 2001 From: "remix-cla-bot[bot]" <92060565+remix-cla-bot[bot]@users.noreply.github.com> Date: Wed, 26 Jan 2022 16:37:34 +0000 Subject: [PATCH 21/39] chore: sort contributors list --- contributors.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contributors.yml b/contributors.yml index c59064a4c3..1a680d01d7 100644 --- a/contributors.yml +++ b/contributors.yml @@ -16,6 +16,7 @@ - kkirsche - koojaa - liuhanqu +- lukerSpringTree - markivancho - mcansh - noisypigeon @@ -29,4 +30,3 @@ - turansky - underager - vijaypushkin -- lukerSpringTree From 1cab4cd507bdccd134e82e4796dda0e3d80b5e0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=81=AB=E7=A5=9E=E4=B8=8D=E5=A4=AA=E7=83=AD?= <46487804+hsbtr@users.noreply.github.com> Date: Sat, 5 Feb 2022 11:57:48 +0800 Subject: [PATCH 22/39] =?UTF-8?q?docs=EF=BC=9AAdd=20unstable=5FHistoryRout?= =?UTF-8?q?er=20to=20the=20api.md=20document=20(#8476)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: liuyan Co-authored-by: Remix Run Bot Co-authored-by: Tim Dorr --- contributors.yml | 1 + docs/api.md | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/contributors.yml b/contributors.yml index 1a680d01d7..3bff63b0d7 100644 --- a/contributors.yml +++ b/contributors.yml @@ -30,3 +30,4 @@ - turansky - underager - vijaypushkin +- hsbtr diff --git a/docs/api.md b/docs/api.md index b9c41d1280..f1800d6843 100644 --- a/docs/api.md +++ b/docs/api.md @@ -29,6 +29,7 @@ To get React Router working in your app, you need to render a router element at - [``](#staticrouter) should be used when server-rendering a website - [``](#nativerouter) should be used in [React Native](https://reactnative.dev/) apps - [``](#memoryrouter) is useful in testing scenarios and as a reference implementation for the other routers +- [``](#unstable_historyrouter) is used with your own [`history`](https://github.com/remix-run/history) instance. These routers provide the context that React Router needs to operate in a particular environment. Each one renders [a ``](#router) internally, which you may also do if you need more fine-grained control for some reason. But it is highly likely that one of the built-in routers is what you need. @@ -233,6 +234,45 @@ describe("My app", () => { }); ``` +### `` + +
+ Type declaration + +```tsx +declare function HistoryRouter( + props: HistoryRouterProps +): React.ReactElement; + +interface HistoryRouterProps { + basename?: string; + children?: React.ReactNode; + history: History; +} +``` + +
+ +`` takes an instance of the [`history`](https://github.com/remix-run/history) library as prop. This allows you to use that instance in non-React contexts or as a global variable. + +```tsx +import * as React from "react"; +import * as ReactDOM from "react-dom"; +import { unstable_HistoryRouter as HistoryRouter } from "react-router-dom"; +import { createBrowserHistory } from "history"; + +const history = createBrowserHistory({ window }); + +ReactDOM.render( + + {/* The rest of your app goes here */} + , + root +); +``` + +This API is currently prefixed as `unstable_` because you may unintentionally add two versions of the `history` library to your app, the one you have added to your package.json and whatever version React Router uses internally. If it is allowed by your tooling, it's recommended to not add `history` as a direct dependency and instead rely on the nested dependency from the `react-router` package. Once we have a mechanism to detect mis-matched versions, this API will remove its `unstable_` prefix. + ### `` > **Note:** From a7a77da997eaa2eb447a7e30915e1f92e401c118 Mon Sep 17 00:00:00 2001 From: "remix-cla-bot[bot]" <92060565+remix-cla-bot[bot]@users.noreply.github.com> Date: Sat, 5 Feb 2022 03:57:51 +0000 Subject: [PATCH 23/39] chore: sort contributors list --- contributors.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contributors.yml b/contributors.yml index 3bff63b0d7..aa0469f113 100644 --- a/contributors.yml +++ b/contributors.yml @@ -7,6 +7,7 @@ - christopherchudzicki - elylucas - hongji00 +- hsbtr - JakubDrozd - jmargeta - jonkoops @@ -30,4 +31,3 @@ - turansky - underager - vijaypushkin -- hsbtr From 0acd4a92b0e197845aa8d6ccc7814466d1be9963 Mon Sep 17 00:00:00 2001 From: Sanket Shah Date: Mon, 14 Feb 2022 07:41:28 +0530 Subject: [PATCH 24/39] docs: Fix broken link in faq.md (#8657) --- contributors.yml | 1 + docs/faq.md | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/contributors.yml b/contributors.yml index aa0469f113..57dbf4dc90 100644 --- a/contributors.yml +++ b/contributors.yml @@ -31,3 +31,4 @@ - turansky - underager - vijaypushkin +- sanketshah19 diff --git a/docs/faq.md b/docs/faq.md index 9d3ff9fad1..dea01feba5 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -37,7 +37,7 @@ function withRouter(Component) { ## Why does `` have an `element` prop instead of `render` or `component`? -We mentioned this [in the migration guide from v5 to v6](../guides/migrating-5-to-6#advantages-of-route-element), but it's worth repeating here. +We mentioned this [in the migration guide from v5 to v6](./upgrading/v5.md#advantages-of-route-element), but it's worth repeating here. In React Router v6 we switched from using v5's `` and `` APIs to ``. Why is that? From d847e34d690e99933111e54f0fcd8886cacd378d Mon Sep 17 00:00:00 2001 From: "remix-cla-bot[bot]" <92060565+remix-cla-bot[bot]@users.noreply.github.com> Date: Mon, 14 Feb 2022 02:11:44 +0000 Subject: [PATCH 25/39] chore: sort contributors list --- contributors.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contributors.yml b/contributors.yml index 57dbf4dc90..ec127fd3ab 100644 --- a/contributors.yml +++ b/contributors.yml @@ -24,6 +24,7 @@ - paulsmithkc - petersendidit - RobHannay +- sanketshah19 - sergiodxa - shivamsinghchahar - thisiskartik @@ -31,4 +32,3 @@ - turansky - underager - vijaypushkin -- sanketshah19 From 1dd9f97235b194976eaf5f6f2680d32e116e33c5 Mon Sep 17 00:00:00 2001 From: abhi-kr-2100 <66527624+abhi-kr-2100@users.noreply.github.com> Date: Mon, 14 Feb 2022 07:41:55 +0530 Subject: [PATCH 26/39] Correct a due date in `src/data.js` (#8658) --- 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 ec127fd3ab..3afdabbfad 100644 --- a/contributors.yml +++ b/contributors.yml @@ -32,3 +32,4 @@ - turansky - underager - vijaypushkin +- abhi-kr-2100 diff --git a/docs/getting-started/tutorial.md b/docs/getting-started/tutorial.md index 4a8032af5c..fc551e23ba 100644 --- a/docs/getting-started/tutorial.md +++ b/docs/getting-started/tutorial.md @@ -305,7 +305,7 @@ let invoices = [ name: "Wide Open Spaces", number: 1998, amount: "$4,600", - due: "01/27/2998" + due: "01/27/1998" } ]; From e5d5b70cb150890f952fa9db0be01909b0fb5f14 Mon Sep 17 00:00:00 2001 From: Chance Strickland Date: Mon, 14 Feb 2022 10:00:39 -0800 Subject: [PATCH 27/39] chore: formatting --- contributors.yml | 3 ++- docs/api.md | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/contributors.yml b/contributors.yml index 3afdabbfad..f2f03d0497 100644 --- a/contributors.yml +++ b/contributors.yml @@ -1,3 +1,4 @@ +- abhi-kr-2100 - Ajayff4 - awreese - bhbs @@ -5,6 +6,7 @@ - chaance - chasinhues - christopherchudzicki +- edwin177 - elylucas - hongji00 - hsbtr @@ -32,4 +34,3 @@ - turansky - underager - vijaypushkin -- abhi-kr-2100 diff --git a/docs/api.md b/docs/api.md index f1800d6843..f01d1144f0 100644 --- a/docs/api.md +++ b/docs/api.md @@ -655,7 +655,7 @@ export default function Dashboard() { return (

Dashboard

- +
); } @@ -669,7 +669,7 @@ export function useUser() { import { useUser } from "../dashboard"; export default function DashboardMessages() { - const user = useUser(); + const { user } = useUser(); return (

Messages

From 7668662895337af01f0a8eb22788e0e6b2f5e344 Mon Sep 17 00:00:00 2001 From: Carl von Buelow Date: Tue, 15 Feb 2022 20:55:59 -0500 Subject: [PATCH 28/39] Update v5 migration guide for Link changes (#8663) --- contributors.yml | 1 + docs/upgrading/v5.md | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/contributors.yml b/contributors.yml index f2f03d0497..e26873a99f 100644 --- a/contributors.yml +++ b/contributors.yml @@ -6,6 +6,7 @@ - chaance - chasinhues - christopherchudzicki +- cvbuelow - edwin177 - elylucas - hongji00 diff --git a/docs/upgrading/v5.md b/docs/upgrading/v5.md index fca0c8cfc2..6c66ffe615 100644 --- a/docs/upgrading/v5.md +++ b/docs/upgrading/v5.md @@ -638,7 +638,17 @@ function App() { } ``` -If you need to replace the current location instead of push a new one onto the history stack, use `navigate(to, { replace: true })`. If you need state, use `navigate(to, { state })`. You can think of the first argument to `navigate` as your `` and the other arguments as the `replace` and `state` props. +If you need to replace the current location instead of push a new one onto the history stack, use `navigate(to, { replace: true })`. If you need state, use `navigate(to, { state })`. You can think of the first argument to `navigate` as your `` and the other arguments as the `replace` and `state` props. The `Link` component in v6 accepts `state` as a separate prop instead of receiving it as part of the object passed to `to` so you'll need to update your `Link` components if they are using `state`: + +```js +import { Link } from "react-router-dom"; + +// Change this: + + +// to this: + +``` If you prefer to use a declarative API for navigation (ala v5's `Redirect` component), v6 provides a `Navigate` component. Use it like: From 65980732714bf6a002b78ab792faac5fb3258ec0 Mon Sep 17 00:00:00 2001 From: hyesung oh Date: Fri, 18 Feb 2022 02:51:54 +0900 Subject: [PATCH 29/39] docs: Fix react-router/README.md's link (#8666) --- contributors.yml | 1 + packages/react-router/README.md | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/contributors.yml b/contributors.yml index e26873a99f..0ecb4ec602 100644 --- a/contributors.yml +++ b/contributors.yml @@ -35,3 +35,4 @@ - turansky - underager - vijaypushkin +- hyesungoh \ No newline at end of file diff --git a/packages/react-router/README.md b/packages/react-router/README.md index 2729e5f4ee..f421dae97e 100644 --- a/packages/react-router/README.md +++ b/packages/react-router/README.md @@ -1,6 +1,6 @@ # React Router -The `react-router` package is the heart of [React Router](/) and provides all +The `react-router` package is the heart of [React Router](https://github.com/remix-run/react-router) and provides all the core functionality for both [`react-router-dom`](/packages/react-router-dom) and From 1d838e406e7a34f51e90950ab50fa1f25bb6f47a Mon Sep 17 00:00:00 2001 From: "remix-cla-bot[bot]" <92060565+remix-cla-bot[bot]@users.noreply.github.com> Date: Thu, 17 Feb 2022 17:52:13 +0000 Subject: [PATCH 30/39] chore: sort contributors list --- contributors.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contributors.yml b/contributors.yml index 0ecb4ec602..099a6ca58a 100644 --- a/contributors.yml +++ b/contributors.yml @@ -11,6 +11,7 @@ - elylucas - hongji00 - hsbtr +- hyesungoh - JakubDrozd - jmargeta - jonkoops @@ -35,4 +36,3 @@ - turansky - underager - vijaypushkin -- hyesungoh \ No newline at end of file From 6800aa4be22aea934ea435bcaefc62ba5b96529c Mon Sep 17 00:00:00 2001 From: BrianT1414 <32641907+BrianT1414@users.noreply.github.com> Date: Thu, 17 Feb 2022 19:38:24 -0600 Subject: [PATCH 31/39] Add import statement to useOutletContext example (#8667) Co-authored-by: Tim Dorr --- contributors.yml | 1 + docs/api.md | 1 + 2 files changed, 2 insertions(+) diff --git a/contributors.yml b/contributors.yml index 099a6ca58a..dae0398f6d 100644 --- a/contributors.yml +++ b/contributors.yml @@ -2,6 +2,7 @@ - Ajayff4 - awreese - bhbs +- BrianT1414 - brockross - chaance - chasinhues diff --git a/docs/api.md b/docs/api.md index f01d1144f0..a55824b907 100644 --- a/docs/api.md +++ b/docs/api.md @@ -646,6 +646,7 @@ If you're using TypeScript, we recommend the parent component provide a custom h ```tsx filename=src/routes/dashboard.tsx lines=[12,17-19] import * as React from "react"; import type { User } from "./types"; +import { Outlet, useOutletContext } from "react-router-dom"; type ContextType = { user: User | null }; From 5a8926a026f0b5b18ec1071665785478eba2341f Mon Sep 17 00:00:00 2001 From: Drew Reese Date: Thu, 17 Feb 2022 17:38:47 -0800 Subject: [PATCH 32/39] Update api.md - Add the `useOutletContext` hook import to example to align with other hook examples. (#8668) --- docs/api.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/api.md b/docs/api.md index a55824b907..eb1c464778 100644 --- a/docs/api.md +++ b/docs/api.md @@ -634,6 +634,8 @@ function Parent() { ``` ```tsx lines=[2] +import { useOutletContext } from 'react-router-dom'; + function Child() { const [count, setCount] = useOutletContext(); const increment = () => setCount(c => c + 1); From fd1a20b15d03b3726a882b6d76235b356715b59c Mon Sep 17 00:00:00 2001 From: Remix Run Bot Date: Fri, 18 Feb 2022 01:39:41 +0000 Subject: [PATCH 33/39] chore: format formatted 5a8926a026f0b5b18ec1071665785478eba2341f --- docs/api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api.md b/docs/api.md index eb1c464778..833c212cfa 100644 --- a/docs/api.md +++ b/docs/api.md @@ -634,7 +634,7 @@ function Parent() { ``` ```tsx lines=[2] -import { useOutletContext } from 'react-router-dom'; +import { useOutletContext } from "react-router-dom"; function Child() { const [count, setCount] = useOutletContext(); From 5f212eb8957e94af578dd2b3b040f7c14d2deff1 Mon Sep 17 00:00:00 2001 From: Logan McAnsh Date: Tue, 22 Feb 2022 12:41:06 -0500 Subject: [PATCH 34/39] ci: update format PAT (#8656) --- .github/workflows/format.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 8c38503718..85eea93a69 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -4,9 +4,11 @@ on: push: branches: - main + - dev jobs: format: + if: github.repository == 'remix-run/react-router' runs-on: ubuntu-latest steps: @@ -15,6 +17,8 @@ jobs: - name: Checkout Repository uses: actions/checkout@v2 + with: + token: ${{ secrets.FORMAT_PAT }} - name: Use Node.js uses: actions/setup-node@v2 @@ -29,7 +33,7 @@ jobs: - name: Commit run: | - git config --local user.email "github-actions@remix.run" + git config --local user.email "hello@remix.run" git config --local user.name "Remix Run Bot" git add . @@ -37,6 +41,6 @@ jobs: echo "💿 no formatting changed" exit 0 fi - git commit -m "chore: format" -m "formatted $GITHUB_SHA" + git commit -m "chore: format" git push echo "💿 pushed formatting changes https://github.com/$GITHUB_REPOSITORY/commit/$(git rev-parse HEAD)" From 59b319feaa12745a434afdef5cadfcabd01206f9 Mon Sep 17 00:00:00 2001 From: Chance Strickland Date: Tue, 22 Feb 2022 13:37:17 -0800 Subject: [PATCH 35/39] chore: Format `main` with Prettier defaults (#8678) * chore: use prettier defaults * chore: format with prettier * chore: update prettier --- FAQ.md | 2 +- docs/api.md | 34 +-- docs/faq.md | 4 +- docs/getting-started/concepts.md | 56 ++--- docs/getting-started/installation.md | 2 +- docs/getting-started/overview.md | 8 +- docs/getting-started/tutorial.md | 50 ++-- docs/prettier.config.js | 2 +- docs/upgrading/reach.md | 12 +- docs/upgrading/v5.md | 26 +-- examples/auth/src/App.tsx | 2 +- examples/auth/src/auth.ts | 2 +- examples/auth/vite.config.ts | 12 +- examples/basic/vite.config.ts | 12 +- examples/custom-filter-link/src/App.tsx | 14 +- examples/custom-filter-link/src/snkrs.ts | 22 +- examples/custom-filter-link/vite.config.ts | 12 +- examples/custom-link/src/App.tsx | 2 +- examples/custom-link/vite.config.ts | 12 +- examples/custom-query-parsing/src/App.tsx | 2 +- examples/custom-query-parsing/vite.config.ts | 12 +- examples/lazy-loading/vite.config.ts | 12 +- examples/modal/src/App.tsx | 12 +- examples/modal/src/images.ts | 12 +- examples/modal/vite.config.ts | 12 +- examples/multi-app/inbox/App.jsx | 8 +- examples/multi-app/inbox/messages.js | 22 +- examples/multi-app/server.js | 4 +- examples/multi-app/vite.config.js | 18 +- examples/route-objects/src/App.tsx | 10 +- examples/route-objects/vite.config.ts | 12 +- examples/search-params/src/App.tsx | 4 +- examples/search-params/vite.config.ts | 12 +- examples/ssr/server.js | 6 +- examples/ssr/vite.config.js | 12 +- package.json | 2 +- .../__tests__/link-click-test.tsx | 2 +- .../__tests__/link-push-test.tsx | 10 +- .../__tests__/navigate-encode-params-test.tsx | 2 +- .../__tests__/static-location-test.tsx | 4 +- .../__tests__/useLinkClickHandler-test.tsx | 10 +- packages/react-router-dom/index.tsx | 22 +- packages/react-router-dom/jest-transformer.js | 4 +- packages/react-router-dom/jest.config.js | 6 +- packages/react-router-dom/server.tsx | 6 +- .../__tests__/deep-linking-test.tsx | 4 +- .../__tests__/link-press-test.tsx | 2 +- .../__tests__/search-params-test.tsx | 4 +- .../react-router-native/__tests__/setup.ts | 2 +- .../__tests__/useLinkPressHandler-test.tsx | 2 +- .../react-router-native/__tests__/utils.ts | 2 +- packages/react-router-native/index.tsx | 18 +- packages/react-router-native/jest.config.js | 8 +- .../__tests__/Routes-location-test.tsx | 2 +- .../__tests__/absolute-path-matching-test.tsx | 20 +- .../__tests__/gh-issue-8165-test.tsx | 2 +- .../__tests__/index-routes-test.tsx | 8 +- .../react-router/__tests__/matchPath-test.tsx | 74 +++--- .../__tests__/matchRoutes-test.tsx | 30 +-- .../__tests__/path-matching-test.tsx | 80 +++---- .../__tests__/resolvePath-test.tsx | 16 +- .../__tests__/route-matching-test.tsx | 18 +- .../__tests__/useNavigate-test.tsx | 2 +- .../react-router/__tests__/useOutlet-test.tsx | 6 +- .../__tests__/useResolvedPath-test.tsx | 2 +- .../react-router/__tests__/useRoutes-test.tsx | 14 +- packages/react-router/index.tsx | 54 ++--- packages/react-router/jest-transformer.js | 4 +- packages/react-router/jest.config.js | 6 +- prettier.config.js | 5 +- rollup.config.js | 220 +++++++++--------- scripts/publish.js | 2 +- scripts/version.js | 12 +- tutorial/src/data.js | 16 +- tutorial/vite.config.js | 12 +- yarn.lock | 8 +- 76 files changed, 589 insertions(+), 590 deletions(-) diff --git a/FAQ.md b/FAQ.md index 7c598e3cb5..3c6a46c616 100644 --- a/FAQ.md +++ b/FAQ.md @@ -120,7 +120,7 @@ const App = () => { return ( } + render={(props) => } /> ); }; diff --git a/docs/api.md b/docs/api.md index 833c212cfa..79b39a0064 100644 --- a/docs/api.md +++ b/docs/api.md @@ -214,7 +214,7 @@ import { create } from "react-test-renderer"; import { MemoryRouter, Routes, - Route + Route, } from "react-router-dom"; describe("My app", () => { @@ -313,7 +313,7 @@ function UsersIndexPage({ users }) {

Users