react router go rprevious page code example
Example 1: useHistory goback
import {useHistory} from "react-router-dom";
const history = useHistory();
Example 2: react router go rprevious page
directly use (()=>this.props.history.goBack())
Example 3: how to make back button react
const BrowserHistory = require('react-router/lib/BrowserHistory').default;
const App = React.createClass({
render: () => {
return (
);
}
});
React.render((
), document.body);
Example 4: how to go back in usinsg router hisotry
this.props.history.goBack(); //react-router (v4)