Files
cal.diy/packages/lib/hooks/useParamsWithFallback.ts
T
b7851e6e53 refactor: next/router hooks with next/navigation hooks (#9105)
Co-authored-by: Alex van Andel <[email protected]>
Co-authored-by: Peer Richelsen <[email protected]>
Co-authored-by: Bailey Pumfleet <[email protected]>
Co-authored-by: Peer Richelsen <[email protected]>
Co-authored-by: Hariom Balhara <[email protected]>
2023-08-02 11:35:48 +02:00

14 lines
319 B
TypeScript

"use client";
import { useParams } from "next/navigation";
import { useRouter } from "next/router";
/**
* This hook is a workaround until pages are migrated to app directory.
*/
export function useParamsWithFallback() {
const router = useRouter();
const params = useParams();
return params || router.query;
}