|
In our application we use nuqs for managing our filters state using the URL. Now when you've filtered on something we show a count of how many active filters you have. Preferably we'd like to be able to derive this count based on if a value is equal to its default value or not. Here's a simplified example: import { useQueryStates } from 'nuqs'
import { parseAsFloat } from 'nuqs/server'
const parsers = {
min: parseAsFloat.withDefault(0),
max: parseAsFloat.withDefault(100),
}
function Client() {
const [filters, setFilters] = useQueryStates(parsers)
const activeFilterCount = // ?
// ...
}Is there currently some way to check which fields differ from their default value? E.g. in the above example I would like to check if the
I might have overlooked some much simpler solution, or maybe there's some better solution to this, but right now I can't really figure out any good way to do it. Also really appreciate the great work on the library! |
Replies: 2 comments
|
Oh yes that's great! Thanks for the quick reply 🙌 |
Would this help? #860 (comment)