Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Uncaught Error: You are loading the CommonJS build of React Router on a page that is already running the ES modules build, so things won't work right

I am trying using this BrowserRoute in my App.js , it is giving me the following error since a long time , unable to resolve this please help me with this.I have installed react-router-dom@5
Here is my code for App.js

import react from 'react'
import Homepage from "./Pages/Homepage"
import ChatPage from "./Pages/ChatPage"
import { Route } from 'react-router-dom';
import { BrowserRouter } from 'react-router-dom/cjs/react-router-dom.min';

function App() {
  return (
    <div className="App">
      <BrowserRouter>
        <Route exact path = "/" component = {Homepage}/>
        <Route exact path = "/chats" component = {ChatPage}/>
      </BrowserRouter>
      
      
    </div>
  );
}

export default App;

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

import { Route, BrowserRouter } from 'react-router-dom';

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading