Skip to content

Commit

Permalink
Addresses remix-run#9011 useParams()'s new {} return
Browse files Browse the repository at this point in the history
Addresses remix-run#9011 useParams()'s new `{}` return
  • Loading branch information
JasonKleban committed Jun 24, 2022
1 parent 38359a9 commit 9cd80a9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/react-router/lib/hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import {
warningOnce,
} from "./router";

const emptyObj = {};

/**
* Returns the full href for the given "to" value. This is useful for building
* custom links that are also accessible and preserve right-click behavior.
Expand Down Expand Up @@ -233,7 +235,7 @@ export function useParams<
> {
let { matches } = React.useContext(RouteContext);
let routeMatch = matches[matches.length - 1];
return routeMatch ? (routeMatch.params as any) : {};
return routeMatch ? (routeMatch.params as any) : emptyObj;
}

/**
Expand Down

0 comments on commit 9cd80a9

Please sign in to comment.