Unverified Commit 0191ef85 authored by Dongho Kim's avatar Dongho Kim Committed by GitHub

docs: update TS example for useSearchParams (#55357)

parent 9817442e
......@@ -272,13 +272,13 @@ You can use [`useRouter`](/docs/app/api-reference/functions/use-router) or [`Lin
export default function ExampleClientComponent() {
const router = useRouter()
const pathname = usePathname()
const searchParams = useSearchParams()!
const searchParams = useSearchParams()
// Get a new searchParams string by merging the current
// searchParams with a provided key/value pair
const createQueryString = useCallback(
(name: string, value: string) => {
const params = new URLSearchParams(searchParams)
const params = new URLSearchParams(searchParams.toString())
params.set(name, value)
return params.toString()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment