import { useHistory } from "react-router-dom";
function HomeButton() {
let history = useHistory();
function handleClick() {
history.push("/home");
}
return (
);
}
Example 2: history.push
// usually all you need
// but you can use a location instead
const location = {
pathname: '/somewhere',
state: { fromDashboard: true }
}
history.push(location)
history.replace(location)