useSearchParams in React
Learn how ChatGPT’s new browser Atlas fits into a frontend developer’s toolkit, including the debugging and testing process.

Users don’t think in terms of frontend or backend; they just see features. This article explores why composition, not reactivity, is becoming the core organizing idea in modern UI architecture.

Discover what’s new in The Replay, LogRocket’s newsletter for dev and engineering leaders, in the November 19th issue.

Jack Herrington writes about how React 19.2 rebuilds async handling from the ground up with use(),
Would you be interested in joining LogRocket's developer community?
Join LogRocket’s Content Advisory Board. You’ll help inform the type of content we create and get access to exclusive meetups, social accreditation, and swag.
Sign up now
5 Replies to "Why URL state matters: A guide to <code>useSearchParams</code> in React"
You can update search params easily with this approach, using native useSearchParams functional update.
setSearchParams((searchParams) => {
searchParams.set(“greeting”, “hi”);
return searchParams;
});
Hi,
Great post!
It would be nice to see a section on how to manage updating multiple keys at the same time.
For example if you set State A then State B you will end up with only State B’s changes.
In my case I am trying to update a start and end date that are updated by the same callback function.
Cheers,
Casey
The first example of useState calls setTotal instead of setGreeting
Thanks for the heads-up, this has been fixed
Created a library to simplify storing state in URL https://www.reddit.com/r/nextjs/comments/17d4x2k/about_using_url_for_managing_state_in_nextjs_13/