Skip to content

Instantly share code, notes, and snippets.

@akellbl4
Last active June 9, 2021 06:14
Show Gist options
  • Save akellbl4/a6d9db9ddf82f7402cb1b7c2f42be529 to your computer and use it in GitHub Desktop.
Save akellbl4/a6d9db9ddf82f7402cb1b7c2f42be529 to your computer and use it in GitHub Desktop.
// pages/params.jsx
import Router, { useRouter } from 'lib/router'
function MyComponent() {
const { query } = useRouter()
function handleSubmit(evt) {
const params = new FormData(evt.currentTarget).getAll("fruits");
evt.preventDefault();
Router.push({ pathname, query: { ...query, params } }, { shallow: true });
}
return <>{...}</>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment