Skip to content

Commit

Permalink
CR
Browse files Browse the repository at this point in the history
  • Loading branch information
Gary Bettencourt authored and molefrog committed Jan 28, 2025
1 parent a23f568 commit c0d37bf
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/wouter/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,10 @@ export const Switch = ({ children, location }) => {

export const Redirect = (props) => {
const { to, href = to } = props;
const [, navigate] = useLocation();
const router = useRouter();
const [, navigate] = useLocationFromRouter(router);
const redirect = useEvent(() => navigate(to || href, props));
const { ssrContext } = useRouter();
const { ssrContext } = router;

// redirect is guaranteed to be stable since it is returned from useEvent
useIsomorphicLayoutEffect(() => {
Expand Down

0 comments on commit c0d37bf

Please sign in to comment.