how to go back to the previous page on button click react code example
Example 1: useHistory goback
import {useHistory} from "react-router-dom";
const history = useHistory();
<button onClick={() => history.goBack()}>Go Back</button>
Example 2: how to go back in usinsg router hisotry
this.props.history.goBack(); //react-router (v4)