1import { Route } from 'react-router-dom'
2
3const Button = () => (
4 <Route render={({ history}) => (
5 <button
6 type='button'
7 onClick={() => { history.push('/new-location') }}
8 >
9 Click Me!
10 </button>
11 )} />
12)
1import { useHistory } from "react-router-dom";
2
3function HomeButton() {
4 let history = useHistory();
5
6 function handleClick() {
7 history.push("/home");
8 }
9
10 return (
11 <button type="button" onClick={handleClick}>
12 Go home
13 </button>
14 );
15}
16