Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
0191ef85
Unverified
Commit
0191ef85
authored
Jan 06, 2024
by
Dongho Kim
Committed by
GitHub
Jan 06, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
docs: update TS example for useSearchParams (#55357)
parent
9817442e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
use-search-params.mdx
...2-app/02-api-reference/04-functions/use-search-params.mdx
+2
-2
No files found.
docs/02-app/02-api-reference/04-functions/use-search-params.mdx
View file @
0191ef85
...
@@ -272,13 +272,13 @@ You can use [`useRouter`](/docs/app/api-reference/functions/use-router) or [`Lin
...
@@ -272,13 +272,13 @@ You can use [`useRouter`](/docs/app/api-reference/functions/use-router) or [`Lin
export default function ExampleClientComponent() {
export default function ExampleClientComponent() {
const router = useRouter()
const router = useRouter()
const pathname = usePathname()
const pathname = usePathname()
const searchParams = useSearchParams()
!
const searchParams = useSearchParams()
// Get a new searchParams string by merging the current
// Get a new searchParams string by merging the current
// searchParams with a provided key/value pair
// searchParams with a provided key/value pair
const createQueryString = useCallback(
const createQueryString = useCallback(
(name: string, value: string) => {
(name: string, value: string) => {
const params = new URLSearchParams(searchParams)
const params = new URLSearchParams(searchParams
.toString()
)
params.set(name, value)
params.set(name, value)
return params.toString()
return params.toString()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment