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.

Passing custom browser history into IonReactRouter

See original GitHub issue

Ionic version:

[x] 4.x [ ] 5.x

I’m submitting a …

[ ] bug report [x] feature request

Current behavior: IonReactRouter doesn’t give you the option to pass in a custom browser history. It would be great if you could do so like you can if you use the Router component from react-router-dom (https://reacttraining.com/react-router/web/api/Router)

Expected behavior: To be able to use custom history like so

// history.ts
import { createBrowserHistory } from 'history';

const history = createBrowserHistory();

export default history;

// App.tsx
import { IonReactRouter } from '@ionic/react-router';
import history from './history';

const App: FC = () => (
  <IonReactRouter history={history}>
    {...}
  </IonReactRouter>
)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:13
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

14reactions
elylucascommented, Jan 27, 2020

IonReactRouter currently wraps BrowserRouter, which doesn’t accept pre-built history.

I’ll look into changing it to wrap Router instead and provide the browser stuff ourselfs.

3reactions
mogusbicommented, Jun 14, 2020

Hi @elylucas, are there any updates on this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Navigation - Ionic Framework
The React Navigation guide covers routing in an app built with Ionic and React. ... You can pass in any props to IonReactRouter...
Read more >
How to push to History in React Router v4? - Stack Overflow
You can use the history methods outside of your components. Try by the following way. First, create a history object used the history...
Read more >
Using React with the History API - Pluralsight
React Router uses the history package, which builds on the browser history API to provide an interface to which we can use easily...
Read more >
Bug: IonReactRouter with history - CodeSandbox
import { createBrowserHistory } from 'history';. /* Core CSS required for Ionic components to work properly */. import '@ionic/react/css/core.css';.
Read more >
History - React Router: Declarative Routing for React.js
The following terms are also used: “browser history” - A DOM-specific implementation, useful in web browsers that support the HTML5 history API; “hash...
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