'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 1:[1]
import { Route, BrowserRouter } from 'react-router-dom';
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Ali Demirci |
