diff --git a/src/hooks/useQueryParams.ts b/src/hooks/useQueryParams.ts index c10289a9..be8c3c86 100644 --- a/src/hooks/useQueryParams.ts +++ b/src/hooks/useQueryParams.ts @@ -6,14 +6,9 @@ export function useQueryParams() { const queryParams = useMemo(() => { // Basic absolutely-not-fool-proof URL query param parser - const obj: Record = {}; - for (const [key, value] of loc.search - .slice(1) - .split("&") - .map((e) => e.split("="))) { - const valueAsNum = Number(value); - obj[key] = Number.isNaN(valueAsNum) ? value : valueAsNum; - } + const obj: Record = Object.fromEntries( + new URLSearchParams(loc.search).entries() + ); return obj; }, [loc]);