Closed anaclumos closed 1 month ago
Use null
in the state updater function: it will remove the key from the URL and return the default value.
https://nuqs.47ng.com/docs/basic-usage#default-values
For useQueryStates, you can do it per key or for all the ones managed by the hook at once:
const [coordinates, setCoordinates] = useQueryStates(coordinatesParsers)
setCoordinates({ lat: null }) // only reset lat
setCoordinates(null) // reset both lat & lng, leave other search params as-is
How can I reset to the default state?