I have tried all the suggested ways in other threads and it is still not working which is why I am posting the question.
So I have history.js looking li
history.js
I had this problem for a while and it was simply not having the withRouter connection.
import { withRouter } from 'react-router'; class Sample extends Component{ render() { { this.props.history.push('/'); window.location.reload(); }}> } } export default withRouter(Sample);
`