useHistory() React hook code example
Example 1: usehistory example
import { useHistory } from 'react-router-dom';
function Home() {
const history = useHistory();
return ;
}
Example 2: usehistory
import { useHistory } from "react-router-dom";
function HomeButton() {
let history = useHistory();
function handleClick() {
history.push("/home");
}
return (
);
}