File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -59,7 +59,8 @@ setSearchParams([["tab", "1"]]);
59
59
setSearchParams (new URLSearchParams (" ?tab=1" ));
60
60
```
61
61
62
- It also supports a function callback like React's [ ` setState ` ] ( https://react.dev/reference/react/useState#setstate ) :
62
+ It also supports a function callback like React's
63
+ [ ` setState ` ] ( https://react.dev/reference/react/useState#setstate ) :
63
64
64
65
``` tsx
65
66
setSearchParams ((searchParams ) => {
@@ -68,6 +69,12 @@ setSearchParams((searchParams) => {
68
69
});
69
70
```
70
71
72
+ <docs-warning >The function callback version of ` setSearchParams ` does not support
73
+ the [ queueing] ( https://react.dev/reference/react/useState#setstate-parameters )
74
+ logic that React's ` setState ` implements. Multiple calls to ` setSearchParams `
75
+ in the same tick will not build on the prior value. If you need this behavior,
76
+ you can use ` setState ` manually.</docs-warning >
77
+
71
78
### Notes
72
79
73
80
Note that ` searchParams ` is a stable reference, so you can reliably use it
You can’t perform that action at this time.
0 commit comments