creativetimofficial / paper-dashboard-react

MIT License
219 stars 380 forks source link

Error: You should not use <Link> outside a <Router> #3

Closed hitvoice closed 5 years ago

hitvoice commented 5 years ago

!!! IF YOU DO NOT USE THIS ISSUES TEAMPLATE, YOUR ISSUE IS LIABLE TO BEING IGNORED BY US

Prerequisites

Please answer the following questions for yourself before submitting an issue.

Expected Behavior

Browse without error.

Current Behavior

When running npm start after npm install, in the browser it says:

You should not use \<Link> outside a \<Router> ▶ 25 stack frames were collapsed. Module../src/index.js src/index.js:14

11 | 
12 | const hist = createBrowserHistory();
13 | 
14 | ReactDOM.render(
15 |   <Router history={hist}>
16 |     <Switch>
17 |       {indexRoutes.map((prop, key) => {

It seems to be something related to react router.

Failure Information (for bugs)

You should not use \<Link> outside a \<Router>

Steps to Reproduce

  1. Download, unzip, cd
  2. npm install
  3. npm start

Context

Failure Logs

image

hitvoice commented 5 years ago

Solve it by following https://github.com/creativetimofficial/material-dashboard-react/issues/87

einazare commented 5 years ago

Hello there, @hitvoice ,

Thank you for your interest in working with our products. Sorry for the late response, we do not work on weekends. In our package.json file we only install "react-router-dom". This package auto-installs "react-router". The problem is that is installing the latest version of "react-router", instead of the same version as "react-router-dom", and that is why you are having this error. Run the following command:

npm i -E react-router@4.3.1

And this will do the trick.

Best, Manu

hitvoice commented 5 years ago

It works. Thanks for the reply!