Upgrade to React Router v4 (#667)
* Upgrade to React Router v4 * Fix pages not change when the URL was changed. This issue is due to the Redux `connect` wrapper around `<App/>`. `connect` diffs changes in regular props to know when to update the component, but doesn't check context props like `location`. See https://github.com/ReactTraining/react-router/blob/master/packages/react-router/docs/guides/blocked-updates.md. * Update to new `history` methods.
This commit is contained in:
@ -1,14 +1,5 @@
|
||||
import { createHashHistory } from 'history';
|
||||
import { useRouterHistory } from 'react-router';
|
||||
import { syncHistoryWithStore } from 'react-router-redux';
|
||||
import createHistory from 'history/createHashHistory';
|
||||
|
||||
let history = useRouterHistory(createHashHistory)({
|
||||
queryKey: false
|
||||
});
|
||||
let history = createHistory();
|
||||
|
||||
const syncHistory = (store) => {
|
||||
history = syncHistoryWithStore(history, store);
|
||||
};
|
||||
|
||||
export { syncHistory };
|
||||
export default history;
|
||||
|
@ -1,35 +0,0 @@
|
||||
import React from 'react';
|
||||
import { Route, IndexRoute } from 'react-router';
|
||||
import App from '../containers/App';
|
||||
import DashboardPage from '../containers/DashboardPage';
|
||||
import CollectionPage from '../containers/CollectionPage';
|
||||
import EntryPage from '../containers/EntryPage';
|
||||
import SearchPage from '../containers/SearchPage';
|
||||
import NotFoundPage from '../containers/NotFoundPage';
|
||||
|
||||
export default (
|
||||
<Route path="/" component={App}>
|
||||
<IndexRoute component={DashboardPage} />
|
||||
<Route
|
||||
path="/collections/:name"
|
||||
component={CollectionPage}
|
||||
/>
|
||||
<Route
|
||||
path="/collections/:name/entries/new"
|
||||
component={EntryPage}
|
||||
newRecord
|
||||
/>
|
||||
<Route
|
||||
path="/collections/:name/entries/:slug"
|
||||
component={EntryPage}
|
||||
/>
|
||||
<Route
|
||||
path="/search/:searchTerm"
|
||||
component={SearchPage}
|
||||
/>
|
||||
<Route
|
||||
path="*"
|
||||
component={NotFoundPage}
|
||||
/>
|
||||
</Route>
|
||||
);
|
Reference in New Issue
Block a user