Skip to content

docs(react-router): updating docs to reflect react router 6 changes#4422

Open
ShaneK wants to merge 4 commits intomajor-9.0from
v9/react-router
Open

docs(react-router): updating docs to reflect react router 6 changes#4422
ShaneK wants to merge 4 commits intomajor-9.0from
v9/react-router

Conversation

@ShaneK
Copy link
Member

@ShaneK ShaneK commented Mar 5, 2026

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.

@ShaneK ShaneK requested a review from a team as a code owner March 5, 2026 15:23
@ShaneK ShaneK requested review from gnbm and removed request for a team March 5, 2026 15:23
@vercel
Copy link

vercel bot commented Mar 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ionic-docs Ready Ready Preview, Comment Mar 9, 2026 4:27pm

Request Review

Copy link
Member

@brandyscarney brandyscarney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 error

I 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.

Comment on lines +47 to +57
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
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

Suggested change
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#### 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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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**
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**Route Definition Changes**
#### Route Definition Changes

Let's make these all headings so they can be linked to

+ <Route path="/" element={<Home />} />
```

**Redirect Changes**
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**Redirect Changes**
#### Redirect Changes

+ <Route path="/sessions/:id" element={<SessionDetail />} />
```

**IonRoute API Changes**
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**IonRoute API Changes**
#### IonRoute API Changes

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

<IonRouterOutlet>
<Redirect exact path="/" to="/home" />
{/*
Use the render method to reduce the number of renders your component will have due to a route change.
Use the component prop when your component depends on the RouterComponentProps passed in automatically.
*/}
<Route path="/home" render={() => <HomePage />} exact={true} />
<Route path="/radio" render={() => <RadioPage />} exact={true} />
<Route path="/library" render={() => <LibraryPage />} exact={true} />
<Route path="/search" render={() => <SearchPage />} exact={true} />
</IonRouterOutlet>

*/
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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you fix this typo in v8 and v7 too just in case we re-deploy them?

Comment on lines -303 to -308
:::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.

:::

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was the version removed? Shouldn't it be updated to v6 since we don't support v7?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants