docs(react-router): updating docs to reflect react router 6 changes#4422
docs(react-router): updating docs to reflect react router 6 changes#4422
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
brandyscarney
left a comment
There was a problem hiding this comment.
There are a lot of unrelated changes on this PR that should be the same as whatever is on the major-9.0 branch. Additionally, running npm start locally fails with:
Error: MDX compilation failed for file "/Users/brandyscarney/Developer/ionic-docs/versioned_docs/version-v8/reference/glossary.md"
Cause: Expected the closing tag `</a>` either after the end of `paragraph` (551:103) or another opening tag after the start of `paragraph` (550:7)
Details:
{
"column": 5,
"message": "Expected the closing tag `</a>` either after the end of `paragraph` (551:103) or another opening tag after the start of `paragraph` (550:7)",
"line": 551,
"name": "551:5-551:9",
"place": {
"start": {
"line": 551,
"column": 5,
"offset": 18407,
"_index": 2,
"_bufferIndex": 4
},
"end": {
"line": 551,
"column": 9,
"offset": 18411,
"_index": 2,
"_bufferIndex": 8
}
},
"reason": "Expected the closing tag `</a>` either after the end of `paragraph` (551:103) or another opening tag after the start of `paragraph` (550:7)",
"ruleId": "end-tag-mismatch",
"source": "mdast-util-mdx-jsx"
}
client (webpack 5.99.5) compiled with 1 errorI would recommend making a new branch off major-9.0, updating it from main, fixing any issues and lint errors on that branch and then merging that back into major-9.0. Update this branch from major-9.0 and then remove any unrelated file changes from this branch so it is purely RR6 related.
| 3. Update to React Router v6: | ||
|
|
||
| ```shell | ||
| npm install react-router@6 react-router-dom@6 | ||
| ``` | ||
|
|
||
| If you have `@types/react-router` or `@types/react-router-dom` installed, remove them. React Router v6 includes its own TypeScript definitions: | ||
|
|
||
| ```shell | ||
| npm uninstall @types/react-router @types/react-router-dom | ||
| ``` |
There was a problem hiding this comment.
I think we should put React Router in its own top-level section like React so it is easier to find and stands out more:
| 3. Update to React Router v6: | |
| ```shell | |
| npm install react-router@6 react-router-dom@6 | |
| ``` | |
| If you have `@types/react-router` or `@types/react-router-dom` installed, remove them. React Router v6 includes its own TypeScript definitions: | |
| ```shell | |
| npm uninstall @types/react-router @types/react-router-dom | |
| ``` | |
| ### React Router | |
| 1. Ionic 9 supports React Router 6. Update to version 6 of React Router: | |
| ```shell | |
| npm install react-router@6 react-router-dom@6 | |
| ``` | |
| 2. If you have `@types/react-router` or `@types/react-router-dom` installed, remove them. React Router 6 includes its own TypeScript definitions: | |
| ```shell | |
| npm uninstall @types/react-router @types/react-router-dom | |
| ``` |
| npm uninstall @types/react-router @types/react-router-dom | ||
| ``` | ||
|
|
||
| #### React Router v6 Migration |
There was a problem hiding this comment.
| #### React Router v6 Migration |
Remove this header and just go into the steps to update
|
|
||
| #### React Router v6 Migration | ||
|
|
||
| Ionic React now requires React Router v6, which has a different API from v5. Below are the key changes you'll need to make: |
There was a problem hiding this comment.
| Ionic React now requires React Router v6, which has a different API from v5. Below are the key changes you'll need to make: | |
| Ionic React now requires React Router v6, which has a different API from v5. Below are the key changes you'll need to make. |
|
|
||
| Ionic React now requires React Router v6, which has a different API from v5. Below are the key changes you'll need to make: | ||
|
|
||
| **Route Definition Changes** |
There was a problem hiding this comment.
| **Route Definition Changes** | |
| #### Route Definition Changes |
Let's make these all headings so they can be linked to
| + <Route path="/" element={<Home />} /> | ||
| ``` | ||
|
|
||
| **Redirect Changes** |
There was a problem hiding this comment.
| **Redirect Changes** | |
| #### Redirect Changes |
| + <Route path="/sessions/:id" element={<SessionDetail />} /> | ||
| ``` | ||
|
|
||
| **IonRoute API Changes** |
There was a problem hiding this comment.
| **IonRoute API Changes** | |
| #### IonRoute API Changes |
There was a problem hiding this comment.
Adding this here so it has a thread:
Don't we need to update the playgrounds as well or is that going to be done on a separate PR? See:
ionic-docs/static/usage/v9/tabs/router/react/main_tsx.md
Lines 19 to 30 in 1307564
| */ | ||
| goBack(animationBuilder?: AnimationBuilder): void; | ||
| /** | ||
| * Determines if there are any additional routes in the the Router's history. However, routing is not prevented if the browser's history has more entries. Returns true if more entries exist, false if not. |
There was a problem hiding this comment.
Can you fix this typo in v8 and v7 too just in case we re-deploy them?
| :::important | ||
|
|
||
| Ionic React Router currently only supports React Router v5. You must install the following specific versions of the router packages to set up routing with Ionic React. | ||
|
|
||
| ::: | ||
|
|
There was a problem hiding this comment.
Why was this removed? Shouldn't it be updated to v6 since we don't support v7?
| ```bash | ||
| npm install @ionic/react-router react-router@5 react-router-dom@5 | ||
| npm install @types/react-router-dom --save-dev | ||
| npm install @ionic/react-router react-router react-router-dom |
There was a problem hiding this comment.
Why was the version removed? Shouldn't it be updated to v6 since we don't support v7?
Description
This PR is preparing the docs for React Router 6 in v9. This PR covers updating the breaking changes for v9 documentation, the migration guide for react router 6, and the react quick start guide.
A large chunk of this PR (everything in v8) is fixing files that previously didn't comply with prettier so that CI will pass.