Wrap your class components with react-router-dom

import {withRouter} from 'react-router-dom'
...
class MyClass extends Component{
	....
}

export default withRouter(MyClass)
Copy the code