1import {useHistory} from "react-router-dom";
2
3const history = useHistory();
4
5<button onClick={() => history.goBack()}>Go Back</button>
1const BrowserHistory = require('react-router/lib/BrowserHistory').default;
2
3const App = React.createClass({
4 render: () => {
5 return (
6 <div><button onClick={BrowserHistory.goBack}>Go Back</button></div>
7 );
8 }
9});
10
11React.render((
12 <Router history={BrowserHistory}>
13 <Route path="/" component={App} />
14 </Router>
15), document.body);
16