Questions tagged [connected-react-router]

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

Developer documentation and resources:

94 questions
90
votes
12 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.…
14
votes
3 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
  • 4,032
  • 3
  • 31
  • 69
10
votes
1 answer

React-testing-library with connected react router together

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

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ć
  • 18,976
  • 10
  • 56
  • 91
6
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,556
  • 2
  • 16
  • 30
5
votes
1 answer

Connected-react-router doesn't work with React 18

I have encountered a problem when trying to install connected-react-router in my test project on React 18: npm installation fails with an error: npm ERR! Found: react@18.1.0 npm ERR! node_modules/react npm ERR! react@"^18.1.0" from the root…
Roman Karagodin
  • 740
  • 2
  • 11
  • 16
5
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…
5
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
  • 1,111
  • 5
  • 16
  • 32
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
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
  • 73,278
  • 17
  • 138
  • 182
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
  • 521
  • 1
  • 6
  • 18
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
  • 456
  • 1
  • 6
  • 18
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
  • 157
  • 2
  • 8
3
votes
1 answer

Typescript ConnectedRouter No overload matches this call

I am new to Typescript. I decide to migrate one of my React Javascript projects to Typescript. Because I am using Connected React Router, I followed its example here, but my IDE (IntelliJ) complains that "No overload matches this call". Here is my…
1
2 3 4 5 6 7