I have this following code:
import {
BrowserRouter as Router,
Route,
Link
} from 'react-router-dom'
const Routes = () => (
<Router basename="/blog">
<div>
<Header />
<Route exact path="/" component={Main}/>
<Route path="/article/:id" component={ArticleView}/>
</div>
</Router>
)
I can access history or match via props in the Main and ArticleView component. But I cannot access it in the <Header />
. Is there a way to get the history object in the Header component?