File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
packages/react-router/lib/dom Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -2151,7 +2151,8 @@ export function useLinkClickHandler<E extends Element = HTMLAnchorElement>(
2151
2151
* setSearchParams(new URLSearchParams("?tab=1"));
2152
2152
* ```
2153
2153
*
2154
- * It also supports a function callback like React's [`setState`](https://react.dev/reference/react/useState#setstate):
2154
+ * It also supports a function callback like React's
2155
+ * [`setState`](https://react.dev/reference/react/useState#setstate):
2155
2156
*
2156
2157
* ```tsx
2157
2158
* setSearchParams((searchParams) => {
@@ -2160,6 +2161,12 @@ export function useLinkClickHandler<E extends Element = HTMLAnchorElement>(
2160
2161
* });
2161
2162
* ```
2162
2163
*
2164
+ * <docs-warning>The function callback version of `setSearchParams` does not support
2165
+ * the [queueing](https://react.dev/reference/react/useState#setstate-parameters)
2166
+ * logic that React's `setState` implements. Multiple calls to `setSearchParams`
2167
+ * in the same tick will not build on the prior value. If you need this behavior,
2168
+ * you can use `setState` manually.</docs-warning>
2169
+ *
2163
2170
* ### Notes
2164
2171
*
2165
2172
* 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