Files
js/hooks/useQueryParam.ts
T
Jonas DanielsandNacho Iacovino 688dc80043 lots of changes to handle new routing (#310)
* lots of changes to handle new routing

* handle some redirect cases

* remove unused stuff

Co-authored-by: Nacho Iacovino <[email protected]>
2022-08-01 09:57:40 -07:00

11 lines
266 B
TypeScript

import { useRouter } from "next/router";
import { getSingleQueryValue } from "utils/router";
export function useSingleQueryParam<T extends string>(
key: string,
): T | undefined {
const { query } = useRouter();
return getSingleQueryValue(query, key) as T;
}