Skip to content

Instantly share code, notes, and snippets.

@Wellers0n
Created January 5, 2023 16:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Wellers0n/2ea4ffc8fb0315c2a285468766feb641 to your computer and use it in GitHub Desktop.
Save Wellers0n/2ea4ffc8fb0315c2a285468766feb641 to your computer and use it in GitHub Desktop.
passing array to query params with nextJS
const { query } = router
const queryParams = {
[field]: [value]?.concat?.(query[field] || [])
}
router.replace({
query: { ...query, ...queryParams },
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment