Redux history binding support react-router - @reach/router - wouter - react-location
MIT License
Bot releases are hidden (Show)
Published by salvoravida about 2 years ago
Published by salvoravida about 2 years ago
import { createReduxHistoryContext } from "redux-first-history";
import { createBrowserHistory } from 'history'; //v5
const { createReduxHistory, routerMiddleware, routerReducer } = createReduxHistoryContext({
history: createBrowserHistory(),
basename: '/app',
//other options if needed
});
Published by salvoravida over 2 years ago
fix: remove deprecated oldLocationChangePayload from interface
Published by salvoravida over 2 years ago
fix: type for Location in locationChangeAction and history 5.x
Published by salvoravida over 2 years ago
Published by salvoravida over 2 years ago
(#64): Add RouterActions type
Published by salvoravida almost 3 years ago
fix (#60): Support history 5.1 types on push/replace
Published by salvoravida almost 3 years ago
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
Published by salvoravida almost 3 years ago
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>
Published by salvoravida almost 3 years ago
fix jest import on rr6
Published by salvoravida almost 3 years ago
Published by salvoravida almost 3 years ago
Published by salvoravida almost 3 years ago
v5.0.2
Published by salvoravida almost 3 years ago
Published by salvoravida almost 3 years ago
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
BREAKING CHANGES:
Published by salvoravida about 3 years ago
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
Published by salvoravida about 4 years ago
history
v5.0.0react-router
v6.0.0-alpha.1BREAKING CHANGES:
import { createReduxHistoryContext, reachify } from "redux-first-history";
import { createWouterHook } from "redux-first-history/wouter";
import { createBrowserHistory } from "history";
const { createReduxHistory, routerMiddleware, routerReducer } = createReduxHistoryContext({
history: createBrowserHistory(),
});
export const history = createReduxHistory(store);
export const reachHistory = reachify(history);
export const wouterUseLocation = createWouterHook(history);
Published by salvoravida over 4 years ago
history
v5.0.0react-router
v6.0.0 (add listenObject: true options )import { createReduxHistoryContext, reachify } from "redux-first-history";
import { createWouterHook } from "redux-first-history/wouter";
import { createBrowserHistory } from "history";
const { createReduxHistory, routerMiddleware, routerReducer } = createReduxHistoryContext({
history: createBrowserHistory(),
listenObject: true, // support react-router v6.0
});
export const history = createReduxHistory(store);
export const reachHistory = reachify(history);
export const wouterUseLocation = createWouterHook(history);
Published by salvoravida over 4 years ago
navigate
from @reach/router
import { navigate } from '@reach/router'`usage:
import { createBrowserHistory } from 'history';
import { globalHistory } from '@reach/router';
const { createReduxHistory, routerMiddleware, routerReducer } = createReduxHistoryContext({
history: createBrowserHistory(),
//others options if needed
reachGlobalHistory: globalHistory
});