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>(
21512151 * setSearchParams(new URLSearchParams("?tab=1"));
21522152 * ```
21532153 *
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):
21552156 *
21562157 * ```tsx
21572158 * setSearchParams((searchParams) => {
@@ -2160,6 +2161,12 @@ export function useLinkClickHandler<E extends Element = HTMLAnchorElement>(
21602161 * });
21612162 * ```
21622163 *
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+ *
21632170 * ### Notes
21642171 *
21652172 * 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