{"id":15687315,"url":"https://github.com/katt/next-use-query-params","last_synced_at":"2025-05-07T19:40:58.229Z","repository":{"id":140087701,"uuid":"359266730","full_name":"KATT/next-use-query-params","owner":"KATT","description":null,"archived":false,"fork":false,"pushed_at":"2021-04-19T13:02:54.000Z","size":37,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-31T13:27:28.388Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"next-use-query-params-git-main-katt.vercel.app","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KATT.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-18T22:34:17.000Z","updated_at":"2022-12-09T12:09:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"473ac3d4-5371-4edd-a1d2-d972d2289ad3","html_url":"https://github.com/KATT/next-use-query-params","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KATT%2Fnext-use-query-params","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KATT%2Fnext-use-query-params/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KATT%2Fnext-use-query-params/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KATT%2Fnext-use-query-params/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KATT","download_url":"https://codeload.github.com/KATT/next-use-query-params/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252945143,"owners_count":21829544,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-03T17:47:12.331Z","updated_at":"2025-05-07T19:40:58.204Z","avatar_url":"https://github.com/KATT.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `useQueryParams()`\n\n\nType-safe query param handling for [Next.js](https://nextjs.org/).\n\n- Demo at: https://next-use-query-params.katt.dev/\n- CodeSandbox: https://githubbox.com/KATT/next-use-query-params\n\n## Example usage\n\n```tsx\nconst { setParams, params } = useQueryParams(\n  {\n    str: \"string\",\n    num: \"number\",\n    pets: {\n      type: \"string[]\",\n    },\n    bool: \"boolean\",\n    withDefault: {\n      type: \"number\",\n      default: 42,\n    },\n    checky: {\n      type: \"string[]\",\n      default: [\"1\"],\n    },\n  },\n);\n```\n\n## Available types\n\n```tsx\ntype ParamOptionTypes =\n  | \"string\"\n  | \"string[]\"\n  | \"number\"\n  | \"number[]\"\n  | \"boolean\";\n```\n\n## Options\n\n```tsx\nexport interface UseQueryParamsOptions {\n  type?: \"replace\" | \"push\";\n  transitionOptions?: TransitionOptions;\n}\n```\n\n**Example:**\n\n```tsx\nconst { setParams, params } = useQueryParams(\n  {\n    // [...]\n  },\n  {\n    type: \"replace\",\n    transitionOptions: {\n      scroll: true,\n    }\n  }\n);\n```\n\n## SSR\n\nIn order to make this work in SSR, you have to opt-out of SSG - see [`pages/_app.tsx`](pages/_app.tsx) for an example on how to disable SSG.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkatt%2Fnext-use-query-params","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkatt%2Fnext-use-query-params","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkatt%2Fnext-use-query-params/lists"}