connected-react-router
connected-react-router copied to clipboard
Route doesn't change when updated via address bar
set up the connected-react-router as doc.but it doesn't change routes when I change url via address bar. It stays on the same page.
import { createStore, applyMiddleware, compose } from "redux";
import thunk from "redux-thunk";
import rootReducer from "store/combineReducers";
import { routerMiddleware } from "connected-react-router";
import { createBrowserHistory } from "history";
export const history = createBrowserHistory();
const middles = [thunk, routerMiddleware(history)];
export default function configureStore(preloadedState) {
const store = createStore(
rootReducer(history), // root reducer with router state
preloadedState,
compose(applyMiddleware(...middles))
);
return store;
}
export default history =>
combineReducers({
router: connectRouter(history),
...
});
ReactDOM.render(
<ThemeProvider>
<Provider store={store}>
<ConnectedRouter history={history}>
<div className="react-root">
<Suspense fallback={<Loading />}>
<Route component={ErrorModal} />
<Route component={WarningModal} />
<Route component={Loading} />
<Switch>
<Route exact path="/" component={Login} />
<Route component={Auth(Wrapper)} />
</Switch>
</Suspense>
</div>
</ConnectedRouter>
</Provider>
</ThemeProvider>,
document.getElementById('root')
);
any suggestions?
Thanks
I have the same problem if i follow these intructions https://github.com/supasate/connected-react-router/issues/299#issuecomment-531435514
... This isnt the actual example is it or bits of three pages of an example? If this is what your trying to run there are obvious problems but I'm guessing these are more or less snippets out of your project?
Same here https://github.com/supasate/connected-react-router/issues/311 Try redux-first-history, no location issue.
@glundgren93 Your routes don't seem to have paths?
I'm having the same issue, as far as I can tell from the README my configuration is correct. @glundgren93 were you ever able to figure out a solution for this?