browser history from react-router code example
Example 1: react router dom push
import { useHistory } from "react-router-dom";
function HomeButton() {
let history = useHistory();
function handleClick() {
history.push("/home");
}
return (
<Button type="button" onClick={handleClick}>
Go home
</Button>
);
}
Example 2: props history
{
key: 'ac3df4', // not with HashHistory!
pathname: '/somewhere',
search: '?some=search-string',
hash: '#howdy',
state: {
[userDefined]: true
}
}