React-admin: Tutorial ends with error "You should not use <Link> outside a <Router>"

Created on 18 Mar 2019  路  10Comments  路  Source: marmelab/react-admin

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

bug

All 10 comments

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)

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.

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?

Been having this issue all morning.

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

https://github.com/ReactTraining/react-router/issues/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 https://github.com/ReactTraining/react-router/issues/6630#issuecomment-473512044

There is also an issue with the [email protected] - 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 [email protected]

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

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

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

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

https://github.com/ReactTraining/react-router/issues/6630

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

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

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

Was this page helpful?
0 / 5 - 0 ratings