react-routerの機能を使用する方法
遷移先へ値を受け渡す方法
import { useHistory } from 'react-router-dom';
const history = useHistory();
history.push({
pathname: '/foo',
state: { bar: 'bar' }
});
遷移元から受け取った値を使用する方法
import { useHistory, useParams } from 'react-router-dom';
const location = useLocation<{ bar: string }>();
location.state.bar;