I have to make nested router in react 4 like react 3 following is my code of App.js
import React, { Component } from 'react';
import './App.css';
import { BrowserRouter as Router, Route, Switch } from "react-router-dom";
import history from './history';
import Home from './components/root/home/Home';
import Root from './components/root/Root';
import Headers from './header/Header';
import Footer from './footer/Footer';
class App extends Component {
render() {
return (
<div className="app-component">
<Router history={history}>
<Route exact path={"/"} component={Root}>
<Route path={"/index"} component={Home} />
</Route>
</Router>
<Headers />
{this.props.children}
<Footer />
</div>
);
}
}
export default App;
what is wrong with code I have to make nested router in react 4 like react 3