We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 11aad9d commit 1108f1cCopy full SHA for 1108f1c
packages/react-router/index.tsx
@@ -526,8 +526,10 @@ export function useOutlet(): React.ReactElement | null {
526
*
527
* @see https://reactrouter.com/docs/en/v6/api#useparams
528
*/
529
-export function useParams<Key extends string = string>(): Readonly<
530
- Params<Key>
+export function useParams<
+ ParamsOrKey extends string | Record<string, string | undefined> = string
531
+>(): Readonly<
532
+ [ParamsOrKey] extends [string] ? Params<ParamsOrKey> : Partial<ParamsOrKey>
533
> {
534
let { matches } = React.useContext(RouteContext);
535
let routeMatch = matches[matches.length - 1];
0 commit comments