cal.pub0.org/packages/lib/hooks/useParamsWithFallback.ts

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;
}