Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Redirect" doesn't work because of [email protected] #7680

Closed
smitroshin opened this issue Nov 5, 2020 · 3 comments
Closed

"Redirect" doesn't work because of [email protected] #7680

smitroshin opened this issue Nov 5, 2020 · 3 comments

Comments

@smitroshin
Copy link

Version

"history": "^5.0.0",  
"react": "^17.0.1",  
"react-dom": "^17.0.1",  
"react-router-dom": "^5.2.0",  
"react-scripts": "4.0.0",  

Test Case

https://codesandbox.io/s/react-router-redirect-issue-ugs02

Steps to reproduce

Simulate navigation to protected route. Just navigate to / route.

Expected Behavior

Because you are not logged in, app should redirect you to /login page.

Actual Behavior

URL is changing but component did not mounting.

Comments

history package recently released a major version - v5.0.0.
Redirect doesn't work because of it. I also describe issue on history repository.

There can also be some changes what breaks react-router .

I use Router with history instead of BrowserRouter with useHistory hook, because I need often access to history from outside of react components.
It would be great if in the future react-router will get me this feature without using history package :)

@timdorr
Copy link
Member

timdorr commented Nov 5, 2020

React Router 5.x isn't compatible with history 5.0.0. This is listed in our dependencies. Simply install a version within the ^4.9.0 range.

@timdorr timdorr closed this as completed Nov 5, 2020
@chasecaleb
Copy link

@timdorr Since you ("you" as in ReactTraining) maintain both of these dependencies, are there plans to address this? Staying on an outdated dependency long-term is not a good solution for many developers/companies.

See also the related discussion here: remix-run/history#810

@timdorr
Copy link
Member

timdorr commented Jan 13, 2021

React Router v6 uses History v5. We already request the correct version in our dependencies for either version of Router.

brophdawg11 pushed a commit that referenced this issue Mar 27, 2024
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants