Skip to content

Adding a array of string to my query #428

Answered by franky47
KatuGT asked this question in Q&A
Discussion options

You must be logged in to vote

In your original post you show code using React's useState, could you show us the relevant useQueryState hook please?

Note that since you're working with arrays, the parseAsArrayOf parser may help with query string formatting here:

import { useQueryState, parseAsArrayOf, parseAsString } from 'next-usequerystate'

const [brands, setBrands] = useQueryState(
  'brands',
  parseAsArrayOf(parseAsString)
    .withDefault([brands])
)

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by franky47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants