I am learning react and trying to set up routes with react-router-dom. All the routes are working except the default route. The content of the default route component displays on all other components when i navigate to their routes. here is the code and the output below
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import One from './one';
import Two from './two';
import Three from './three';
import FourOFour from './404';
import registerServiceWorker from './registerServiceWorker';
import {BrowserRouter, Route} from 'react-router-dom';
ReactDOM.render(
<BrowserRouter>
<div>
<Route exact={true} path="/" component={App}></Route>
<Route path="/One" component={One}></Route>
<Route path="/Two" component={Two}></Route>
<Route path="/Three" component={Three}></Route>
<Route path="*" component={FourOFour}></Route>
</div>
</BrowserRouter>,
document.getElementById('root')
);
registerServiceWorker();