Questions tagged [connected-react-router]

connected-react-router allows the binding of the react-router state with the redux store.

Developer documentation and resources:

84 questions
56
votes
11 answers

Is there a way to modify the page title with React-Router v4+?

I'm looking for a way to modify the page title when React-Router v4+ changes locations. I used to listen for a location change action in Redux and check that route against a metaData object. When using React-Router v4+, there's no fixed routes list.…
9
votes
2 answers

connected-react-router - You should not use outside a

Similar questions have been asked before but this seems to be specific to connected-react-router. I can use Router or BrowserRouter from react-router(-dom) and there is no issue but I want to incorporate Redux hence the use for this…
wmash
  • 3,144
  • 3
  • 21
  • 53
8
votes
0 answers

React-testing-library with connected react router together

I am trying to test a workflow with a React app. When all fields are filled withing a workflow step, user is able to click to the "next" button. This action registers a state in a reducer and changes the URL to go to the next workflow…
7
votes
1 answer

What is the "key" which changes on every route change with connected-react-router?

When an action for navigating to a route is triggered, an action triggers a new state where the router.location.pathname changes according to the browser's history. Another property changes as well: router.location.key, to a new random string. Even…
Lazar Ljubenović
  • 15,745
  • 7
  • 45
  • 80
5
votes
2 answers

react-router connected to redux : works with links but only the URL change when dispatching push

I'm trying to programmatically push an URL to navigate with react-router, redux, and connected-react-router When clicking on a button, it's working great, the URL is changing and the route too. But when using a dispatch(push(url)), the URL…
Kai23
  • 1,436
  • 1
  • 16
  • 27
5
votes
2 answers

React Router props `location` / `match` not updating with `ConnectedRouter`

I've got my app setup as in the docs: Step 1 ... import { createBrowserHistory } from 'history' import { applyMiddleware, compose, createStore } from 'redux' import { connectRouter, routerMiddleware } from 'connected-react-router' ... const history…
4
votes
0 answers

ConnectedRouter redirects to '/' on page reload on initial render

I have a React-Redux App with React-Router and connected-react-router (to be able to change location within redux actions): const main = () => { hydrate(
PeteMeier
  • 301
  • 3
  • 14
4
votes
1 answer

Can't resolve module 'react-redux' in connected-react-router with react-redux and redux modules installed

I'm trying to use connected-react-router module. From the docs, this is my code in the reducer: import { combineReducers } from 'redux'; import login from './loginReducer'; import { connectRouter } from 'connected-react-router' export default…
4
votes
1 answer

Connected React Router and TypeScript for `match`

Connected React Router exports types for RouterState which is great! However I don't see typings for match. Would assume those could also be imported and added to reducer such as RouterState is used below and in reducer:…
Bess
  • 326
  • 5
  • 17
4
votes
1 answer

Redux Sagas not entered with redux persist and connected-react-router

I have a react web app that uses redux, connected-react-router, redux saga and redux persist and HMR with react-hot-loader and webpack. After doing a major update to most of the packages I noticed that the sagas are not entered / executed. The…
cbutler
  • 729
  • 3
  • 10
  • 24
4
votes
1 answer

reactjs: connected-router is not redirecting the user after push call is made

I would like my saga to redirect a logging in user to a main dashboard screen after successful authentication. I followed the code outlined in the following article: https://github.com/supasate/connected-react-router and example from…
4
votes
1 answer

Setting Up Connected React Router

I'm trying to set up connected-react-router according to the steps in the README. I have this current code in my store.js: import { createStore } from 'redux'; import reducer from './reducers'; import { middleware, runSagas } from…
Rachel
  • 147
  • 2
  • 7
3
votes
3 answers

React Router `history` and `location` mismatched after back button

In my React app, after navigating from Home to a child page and then hitting the back button, React shows a mismatched location in it's internal state vs the props it's passed from history and the incorrect is displayed for the…
Samuel Neff
  • 67,422
  • 16
  • 123
  • 169
3
votes
1 answer

return type for redux root reducer

I am convert my root reducer from javascript to typescript, however, I am getting a linting error saying: Missing return type on function. (@typescript-eslint/explicit-function-return-type) What should be the proper return type for my root…
Jimmy
  • 1,580
  • 2
  • 23
  • 55
3
votes
1 answer

Can't deal with Uncaught TypeError: Cannot read property 'location' of undefined at createRouterReducer

I have a problem with connecting a Router to a rootReducer, console logs Uncaught TypeError: Cannot read property 'location' of undefined at createRouterReducer (reducer.js?005c:9) ... Don't know how to fix it and connect the router…
1
2 3 4 5 6