question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: ionic react does not support history@5.x

See original GitHub issue

Bug Report

Ionic version:

[ ] 4.x [x] 5.6.6

Current behavior:

In Ionic React, the nested route declared is not rendered when navigated to the corresponding url after upgrading to the latest version of ionic(5.6.6)

Expected behavior:

The nested route is rendered.

Steps to reproduce:

Please check this link for the code. This is from the example of nested navigation from the ionic docs, but the ionic packages have been updated to version 5.6.6 - https://stackblitz.com/edit/ionic-react-routing-bhuvg6?file=src/index.tsx

Related code:

App.tsx

  <IonApp>
    <IonReactRouter>
      <IonRouterOutlet>
        <Route path="/dashboard" render={props => <DashboardPage {...props} />} />
        <Route exact path="/" render={() => <Redirect to="/dashboard" />} />
      </IonRouterOutlet>
    </IonReactRouter>
  </IonApp>

DashboardPage.tsx

    <IonRouterOutlet>
      <Route exact path={match.url} component={UsersListPage} />
      <Route path={`${match.url}/users/:id`} component={UserDetailPage} />
    </IonRouterOutlet>

Ionic info:

Ionic:

   Ionic CLI       : 6.10.1 (C:\Users\justi\AppData\Roaming\npm\node_modules\@ionic\cli)
   Ionic Framework : @ionic/react 5.6.6

Capacitor:

   Capacitor CLI   : not installed
   @capacitor/core : 2.4.7

Utility:

   cordova-res : not installed
   native-run  : not installed

System:

   NodeJS : v12.19.0 (C:\Program Files\nodejs\node.exe)
   npm    : 6.14.8
   OS     : Windows 10

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
justinpathrosecommented, May 14, 2021

React Router v5 expects history@4.x, so I do not recommend using history@5.x right now since you may run into other errors.

React Router v6 will be using history@5.x, so I do still think we should support this in Ionic React.

Can you try the following dev build and let me know if it resolves the issue?

npm install @ionic/react@5.7.0-dev.202105122134.ef72e07 @ionic/react-router@5.7.0-dev.202105122134.ef72e07

Thank you! Both the solutions worked for me.

0reactions
ionitron-bot[bot]commented, Jun 13, 2021

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

bug: ionic react does not support history@5.x #23294 - GitHub
React Router v6 will be using history@5.x , so I do still think we should support this in Ionic React. Can you try...
Read more >
passing history props to IonReactRouter doesn't work as ...
I have a separate history.ts file. // history.js import { createBrowserHistory } from 'history'; export default createBrowserHistory({ ...
Read more >
@ionic/core | Yarn - Package Manager
Ionic is an open source app development toolkit for building modern, fast, top-quality cross-platform native and Progressive Web Apps from a single codebase ......
Read more >
history.push() is undefined when using react Context (Ionic ...
Closed last year. UseHistory Hook while trying to push to another page says undefined while trying to programmatically navigate after the async ...
Read more >
status bar dating app notification icons android
So here's the scenario: you grab your phone and don't see anything in the ... Found out by trial and error, dating the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found