Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

11
  • Check the duplicate, you App component renders the Header but Header doesn't receive router props, either write <Header {...this.props} /> or use withRouter on Header like export default withRouter(connect(mapStateToProps)(Header)); Commented Feb 15, 2018 at 7:32
  • @ShubhamKhatri Hi, I made edits in the question after looking at the duplicate you mentioned. Pls have a look. I can't use exact path and withRouter did not change anything. Commented Feb 15, 2018 at 8:15
  • You don't need withRouter in the App component, but in Header, I have already mentioned it in my comment above, also you don't need exact prop Commented Feb 15, 2018 at 8:24
  • @ShubhamKhatri Sorry I'm sorry I did not see properly. But I did use withRouter in Header and I still face the same problem. I also tried passing props to Header as you said. Still the route not working properly Commented Feb 15, 2018 at 8:31
  • 1
    Check this codesandbox codesandbox.io/s/k9q15oo703, moved some of the routes in App Commented Feb 15, 2018 at 8:49