how to know the current route in react class component
/*For class based components*/
import { withRouter } from 'react-router-dom';
class SomeComponent extends Component {
render() {
console.log(this.props.location)
console.log(this.props.location.pathname)
console.log(this.props.location.match)
return <div>Something</div>
}
}
export default withRouter(SomeComponent)