nuqs Profile Banner
nuqs Profile
nuqs

@nuqs47ng

1,212
Followers
30
Following
27
Media
208
Statuses

Type-safe search params state manager for React frameworks. Like useState, but stored in the URL query string. Made by @fortysevenfx & contributors

location.search
Joined August 2024
Don't wanna be here? Send us removal request.
Pinned Tweet
@nuqs47ng
nuqs
11 days
📦 nuqs @2 .0.0 is out ! 🚀 ⚛️ Works with @nextjs 14 & 15, but also @reactjs , @remix_run , react-router, and more 🧪 Testable: unit-test your components in isolation 🪶 20% smaller bundle size Try it now: pnpm add nuqs @latest
23
59
731
@nuqs47ng
nuqs
1 month
Hello, @remix_run ! 👋
8
5
185
@nuqs47ng
nuqs
23 days
Crazy to think that this account is only two months old. Thanks everyone! 🙏 We're just getting started. 🚀
Tweet media one
3
0
90
@nuqs47ng
nuqs
1 month
Fun fact: you can use the createSearchParamsCache feature of nuqs to parse and make dynamic segment slugs (route params) accessible to a page's RSC tree, without prop drilling, just like search params. Don't stop at the name: it will parse & cache any { [key]: string } object.
Tweet media one
1
5
34
@nuqs47ng
nuqs
1 month
Follow along as @theorcdev refactors a @shadcn table to store filters & pagination in the URL with nuqs ⬇️
Tweet media one
2
4
29
@nuqs47ng
nuqs
1 month
📦 nuqs @1 .19.3 is out! 🚀 - Supports Next.js 15's upcoming async searchParams page prop (introduced in latest @nextjs canary) - Makes the serializer base accept read-only searchParams from useSearchParams.
@fortysevenfx
François Best - oss/?=&
1 month
I love waking up to breaking changes in @nextjs core 🙃 This one is going to be a pain to handle properly in @nuqs47ng 😓
Tweet media one
9
14
188
1
3
28
@nuqs47ng
nuqs
26 days
📦 nuqs @1 .20.0 is out! 🚀 - Remap useQueryStates keys: no more trade-off between shorter URLs & meaningful variables - Serializer gets support for `null` to clear all managed search params from the base (h/t @neefrehman_ ) 📥 pnpm add nuqs @latest
@fortysevenfx
François Best - oss/?=&
26 days
Coming soon to @nuqs47ng (like, tonight): `useQueryStates` gets a new option to rename keys. - Use variable names that make sense for your business logic - Remap them to a different search param key - Type-safe mapping, of course. Super handy for shortening URLs.
Tweet media one
4
6
100
0
1
25
@nuqs47ng
nuqs
2 months
📦 nuqs @1 .19.0 is out! - useQueryStates gets some DX love - performance boost due to not running parsers when not needed - referential stability for object/arrays states Get it now:
Tweet media one
1
2
17
@nuqs47ng
nuqs
1 month
never underestimate query strings.
1
1
10
@nuqs47ng
nuqs
14 days
@pontusab @NuQs @shadcn Being at the top of this list of all-star libraries is such an honour! 🤩🙌
0
0
9
@nuqs47ng
nuqs
2 months
Look ma', no router!
@fortysevenfx
François Best - oss/?=&
2 months
Me, cooking: "What's your favourite ice cream flavour?" @nuqs47ng : "vanilla."
5
1
24
0
0
5
@nuqs47ng
nuqs
1 month
nuqs 🤝 T3 stack
@theo
Theo - t3.gg
1 month
@fortysevenfx @nuqs47ng You did! I’ll be implementing this on PicThing some time next week 🫡
1
0
5
0
0
5
@nuqs47ng
nuqs
1 month
@anthony_hagi @remix_run Probably react-router support, since the APIs are the same it should be straightforward.
1
0
4
@nuqs47ng
nuqs
1 month
@nikelsnik @victorbayas @nextjs Correct! Here is the preview running plain React alongside React Router:
@fortysevenfx
François Best - oss/?=&
1 month
Having a bit of fun: syncing the same React app with @nuqs47ng components, mounted twice. One with the vanilla React adapter, one through React Router. Even with "islands", everything is in sync, thanks to URL state.
1
1
19
1
0
4
@nuqs47ng
nuqs
29 days
Adapters are such a good idea that we will spend the rest of the decade continuing to explore its implications and applications.
@fortysevenfx
François Best - oss/?=&
29 days
A new React / RN framework, @one__js was released yesterday at @viteconf 🟡 I couldn't resist to try @nuqs47ng on it, with an adapter written in 10 minutes and 9 lines of code 🤯 Congrats on the launch @natebirdman , @jshez & @zetavg !
1
2
23
0
0
4
@nuqs47ng
nuqs
1 month
@YTCodeAntonio @fortysevenfx @nextjs @reactjs @vite_js @remix_run @vitest_dev Be mindful that URLs have a maximum size (up to 2048 characters is considered safe). Not every state belongs in the URL. To know if it does, this is a good starter:
@housecor
Cory House
5 months
There are over 30 different ways to handle React state. Here's how I decide.
Tweet media one
35
158
1K
0
1
4
@nuqs47ng
nuqs
1 month
@yomaru_1999 @remix_run Very early preview (this will be shipped in v2):
0
0
4
@nuqs47ng
nuqs
1 month
@GreggLuskin For SSR, it would be great to give the cache feature a validation argument where you could feed a Zod schema (or its parse function to make it validation-lib agnostic). Would something like this work for you?
Tweet media one
2
0
3
@nuqs47ng
nuqs
26 days
@jal_eelll @shadcn You might want to use a Date parser here: For an improvement over the stock ones, check out what @tremorlabs did on their demo page, with a single key providing two [start, end] dates. 🧑‍🍳💋 We'll add some of these common custom parsers to the docs soon!
2
0
3
@nuqs47ng
nuqs
1 month
@_rayaanr @fortysevenfx Here's a basic example toggling a list of tags: Feel free to open a discussion in the repository if you have more questions!
Tweet media one
1
0
2
@nuqs47ng
nuqs
2 months
. @fortysevenfx and I will be tuning in 👀
Tweet media one
@nextjs
Next.js
2 months
Next.js Conf is here. Join us in SF or online Oct 24. • Sessions led by you (apply today) • Hands-on workshops led by Next.js experts • Meet and learn from the community Register now and apply to speak:
25
135
740
0
1
2
@nuqs47ng
nuqs
2 months
@ryo__kts そして、自分で手作りすることもできます!
0
1
2
@nuqs47ng
nuqs
1 month
@digitalconner @nikelsnik @nextjs You can't use Context on the server, it's a client-only feature. You could pass those props via Context to client components, but they already have access to it via useParams and useSearchParams. This cache pattern bridges the gap by acting like a server-side context.
1
0
2
@nuqs47ng
nuqs
11 days
📦 nuqs @2 .0.1 is out! 🚀 A couple of bug fixes after the big release: - Fix @nextjs pages router import (next/navigation.js) - Don't install all optionalDependencies (h/t @nezouse & @AlemTuzlak ) TIL: peerDependencies and peerDependenciesMeta.*.optional: true does the job.
Tweet media one
1
4
87
@nuqs47ng
nuqs
12 days
@_MusKRii @justansub @fortysevenfx You'll want to set `shallow: false` to notify the server and re-render RSCs:
1
0
2
@nuqs47ng
nuqs
1 month
@GreggLuskin There's a discussion about Zod integration here: TL;DR: - Zod is great for validating deserialized state coming from search params. - nuqs provides parsers & associated serializers to convert state to/from query string values - Combining both is needed
1
0
2
@nuqs47ng
nuqs
1 month
@jal_eelll @shadcn The searchParamsCache won't work on client components, you'll need to split your definition this way: export const searchParamsParsers = { ... } export const searchParamsCache = createSearchParamsCache(searchParamsParsers) Then in your client component, use searchParamsParsers.
1
0
1
@nuqs47ng
nuqs
2 months
@tibotiber @mxkaske Next.js only (for now, stay tuned 👀)
0
0
1
@nuqs47ng
nuqs
1 month
@sudo_kw Thanks! 🙏
0
0
1
@nuqs47ng
nuqs
2 months
@infodusha @nikelsnik @nextjs Unfortunately Zod doesn't provide the serialisation needed when updating the URL. For simple types, the built-in `toString` might be enough. Parsing a boolean also needs preprocessing in Zod, otherwise the string `"false"` being a truthy value returns `true` as a boolean.
0
0
1
@nuqs47ng
nuqs
2 months
@itsarminbabaei @pontusab To construct a URL with serialised params (the same way the hooks do), you can use the serializer helper:
1
0
1
@nuqs47ng
nuqs
27 days
0
0
1
@nuqs47ng
nuqs
28 days
@GreggLuskin To be fair, the pattern could be adapted to be completely agnostic of nuqs, and be shipped in a separate package. That would allow it to work for params, search params and any Record<string, string> type.
0
0
1
@nuqs47ng
nuqs
2 months
@nikelsnik Tip: don't forget the `as const` after the literal option arrays. Otherwise it broadens the type to `string` or `number`, rather than `"graphite" | "sage"` or `2 | 4 | 6`.
1
0
1