Redux history binding support react-router - @reach/router - wouter - react-location
import { createReduxHistoryContext } from "redux-first-history";
import { createBrowserHistory } from 'history'; //v5
const { createReduxHistory, routerMiddleware, routerReducer } = createReduxHistoryContext({
history: createBrowserHistory(),
basename: '/app',
//other options if needed
});
fix: remove deprecated oldLocationChangePayload from interface
fix: type for Location in locationChangeAction and history 5.x
(#64): Add RouterActions type
fix (#60): Support history 5.1 types on push/replace
rr6 support :
import { HistoryRouter as Router } from "redux-first-history/rr6";
import { Route, Routes, Navigate } from "react-router-dom";
//...
import { store, history } from "./store";
//...
<Router history={history}>
<Routes>
<Route path="/dashboard" element={<Dashboard />} />
<Route path="/" element={<Home />} />
<Route path="*" element={<Navigate to="/" />} />
</Routes>
</Router>
demo rr6 here: https://codesandbox.io/s/redux-first-history-demo-rr6-uccuw
rr6 support :
import { Route, Routes, Navigate, HistoryRouter as Router } from "react-router-dom";
import { store, history } from "./store";
//...
<Router history={history}>
<Routes>
<Route path="/dashboard" element={<Dashboard />} />
<Route path="/" element={<Home />} />
<Route path="*" element={<Navigate to="/" />} />
</Routes>
</Router>