Topic: You should not use <Route> or withRouter() outside a <Router>

satish24 free asked 5 years ago


Expected behavior*Should Display NavBar*Actual behavior**Error : You should not use or withRouter() outside a **Resources (screenshots, code snippets etc.)

I've wrapped the components with Index.js

import React from "react";

import { render } from "react-dom";import App from "./App";import "mdbreact/dist/css/mdb.css";//import "../src/css/customStyle.css";import { BrowserRouter } from "react-router-dom";

render( , document.getElementById("root"));

App. js

export class App extends Component {

render() { return ( ); }}

package.json;

   "mdbreact": "^4.13.0",
"react": "^16.8.5",
"react-bootstrap": "^1.0.0-beta.8",
"react-dom": "^16.8.5",
"react-redux": "^7.0.2",
"react-router": "^5.0.0",
"react-router-dom": "^5.0.0",

Aliaksandr Andrasiuk staff answered 5 years ago


Hi,

Our MDBReact package has some problems with the react-router-dom v.5.0.0. Try to add an earlier version of react-router-dom as a dependency in your package.json file.

If it will not help please show me your code.

Best regards.



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB React
  • MDB Version: 4.13.0
  • Device: Laptop
  • Browser: Chrome
  • OS: Windows
  • Provided sample code: No
  • Provided link: No