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

Tutorial ends with error "You should not use <Link> outside a <Router>" #3018

Closed
dzoudzou opened this issue Mar 18, 2019 · 10 comments
Closed
Labels

Comments

@dzoudzou
Copy link

Tutorial ends with an error.
You should not use <Link> outside a <Router>

@eligao
Copy link

eligao commented Mar 18, 2019

I just noticed the bug only appears on desktop view:
image
On a phone or when the window is small enough, this page renders as a mobile view and doesn't suffer from this bug.
14nl4pw6k4 codesandbox io_(iPhone 6_7_8)

@MiMo42
Copy link
Contributor

MiMo42 commented Mar 18, 2019

Same here with my project.
yarn upgrade
grabs the v4.4.0 release of react-router as a dependency for react-admin.
Dependency hell...

I had to change the react-router dependency NOT to use the version 4.4.0 of react-router.
Using react-router 4.4.0 my app sends lots of warnings about deprecated require statements to the console and also ends with You should not use <Link> outside a <Router> error.

The release tagged as "Latest release" (it's the 4.3.1) of react-router does work.

@Kmaschta Kmaschta added the bug label Mar 18, 2019
@fzaninotto
Copy link
Member

what's the "Tutorial ends with an error."? Can you please provide a sample project triggering the issue?

Also, since it seems to be a regression on the react-router side, did any of the commenter here open an issue in the react-router repository?

@vaiulian
Copy link

Been having this issue all morning.

so this weekend it seems react-router and react-router-dom changed versions:

remix-run/react-router#6630

"You should not use react-router-dom version 4.3.1 with react-router 4.4.0."

i managed to bypass this issue using this remix-run/react-router#6630 (comment)

@vaiulian
Copy link

There is also an issue with the history@4.8.0 - deprecating

var createHistory = require('history/createMemoryHistory');

Instead, use:

var createHistory = require("history").createMemoryHistory;

https://github.com/ReactTraining/history/releases

So my big "FIX" is something like

"resolutions": { "react-router": "4.2.0", "react-router-dom": "4.2.0", "history": "4.7.2" }, for react-admin@2.7.0

Still some changes to react-admin core needs to be done.

@nagad814
Copy link

Please fix this breaking change; I am getting ready for a demo. Would probably downgrade or try working around.

@eligao
Copy link

eligao commented Mar 19, 2019

what's the "Tutorial ends with an error."? Can you please provide a sample project triggering the issue?

Also, since it seems to be a regression on the react-router side, did any of the commenter here open an issue in the react-router repository?

Check out my example (https://codesandbox.io/s/14nl4pw6k4) from my issue #3019

@fzaninotto
Copy link
Member

The react-router team seems to have fixed the problem on their side.

remix-run/react-router#6630

Can you please remove your node_modules, run yarn again and check if it fixes the bug?

@MiMo42
Copy link
Contributor

MiMo42 commented Mar 20, 2019

@fzaninotto
Yes, this fixed the bug for me.
Thanks!

@djhi djhi closed this as completed Mar 20, 2019
@MiMo42
Copy link
Contributor

MiMo42 commented Mar 20, 2019

@vaiulian
I added Issue #3028 for the warnings due to deprecated requires of history@4.8.0,
as that one is not directly related to the problem this issue has been created for originally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants