Closed reZach closed 2 years ago
Hi there @reZach
1.) remove "connected-react-router": "^6.9.2", 2.) delete package-lock.json and recreate it, as it is corrupted with both history 4.x/5.x packages
lmk!
Thanks @salvoravida , I tried these suggestions (and updated that repo) yet I still see the same issue. Do you have another suggestion?
@salvoravida, npm i history
needed to be ran such that history
existed and was version 5, due to your comment here which requires a version of history
of 5 to be present if react-router
version 6 is present. Doing so fixed the issue!
no you do not need to install history5, it is already a dep of react-router v6.
Anyway your project is corrupted. Here is a test project with your code, that works.
https://codesandbox.io/s/rfh-issue-test-ephnte
Best regards.
Also had such a problem. Tried with history 4.10.* and history 5.3.0. And tried to remove history dep from the project. Worked solution for me is to install history 5.0.0.
Hello, thank you for this repo! I was directed here based on your comment of using redux-first-history instead of connected-react-router. I wanted to ask, because I feel like I'm following your instructions properly, but I'm running into a strange error. Here is what I have. Everything is pretty much boilerplate from what's in the README:
store.js (with @reduxjs/toolkit)
app.js (react-router v6)
routes.jsx
welcome.jsx
about.jsx
My app loads fine, but as soon as I try to navigate to another page I get this error
Cannot read properties of undefined (reading 'pathname')
. I can't figure out if this is an error in redux-first-history or somewhere else. This comment makes me feel like<HistoryRouter>
needs to support something like this (but I'm not entirely sure).Can you point me in the right direction?
repro steps
I made a small POC repo where this can be replicated https://github.com/reZach/react-router-v6-upgrade