Skip to content

Why? #495

Answered by franky47
caioluis asked this question in Q&A
Why? #495
Feb 11, 2024 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

This is a great question to ask!

Usual cases for this would be places where you'd normally use React.useState, but want on top of it:

  • Being able to link to a particular value (sharing a URL with others)
  • Bookmarking and saving in browser history
  • Navigating directly from another place in your app (using <Link> components)

Now there are lots of types of state in a web application, many of which would be unsuitable for this pattern, like server state, or local temporary UI state that does not warrant linkability.

Things that the community tends to use nuqs for include:

  • Search (adding a ?q=my+search+input in the URL to link back to a results page)
  • Pagination (?page=47, using parseAsInteger,…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@caioluis
Comment options

Answer selected by caioluis
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