Passing custom browser history into IonReactRouter
See original GitHub issueIonic 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:
- Created 4 years ago
- Reactions:13
- Comments:12 (2 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
Hi @elylucas, are there any updates on this?