React: Hide a Component on a specific Route
I’m new to React too, but came across this problem. A react-router based alternative to the accepted answer would be to use withRouter, which wraps the component you want to hide and provides it with location prop (amongst others). import { withRouter } from ‘react-router-dom’; const ComponentToHide = (props) => { const { location } … Read more