Użyterz

import {useHistory} from "react-router-dom";

const history = useHistory();

<button onClick={() => history.goBack()}>Go Back</button>
Defeated Dogfish