Answer the question
In order to leave comments, you need to log in
How to get history in this case?
Hello.
In a react app, I am using react-router-dom. The code below shows the structure (App.js):
<Layout>
<Header/>
<Switch>
<Route path = '/' exact component = {Home}/>
<Route path = '/news' component = {News}/>
<Route path = '/profile' component = {Profile}/>
<Route path = '/login' component = {Login}/>
</Switch>
</Layout>
ReactDOM.render(
<Router history = {history}>
<App />
</Router>,
document.getElementById('root')
);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question