How to push to History in React Router v4?
You can use the history methods outside of your components. Try by the following way. First, create a history object used the history package: // src/history.js import { createBrowserHistory } from ‘history’; export default createBrowserHistory(); Then wrap it in <Router> (please note, you should use import { Router } instead of import { BrowserRouter as … Read more