From c2351cd09727b9eb9bdf10abc57153ef08220db1 Mon Sep 17 00:00:00 2001 From: "Amir H. Hashemi" <87268103+amirhhashemi@users.noreply.github.com> Date: Sun, 30 Nov 2025 18:51:52 +0330 Subject: [PATCH] Update useSearchParams reference page --- .../primitives/use-search-params.mdx | 90 +++++++++++++------ 1 file changed, 64 insertions(+), 26 deletions(-) diff --git a/src/routes/solid-router/reference/primitives/use-search-params.mdx b/src/routes/solid-router/reference/primitives/use-search-params.mdx index 0aa58b7cf..224a6f49b 100644 --- a/src/routes/solid-router/reference/primitives/use-search-params.mdx +++ b/src/routes/solid-router/reference/primitives/use-search-params.mdx @@ -1,6 +1,6 @@ --- title: useSearchParams -use_cases: 'pagination, filters, search forms, url state management, query string updates' +use_cases: "pagination, filters, search forms, url state management, query string updates" tags: - search - query @@ -8,34 +8,72 @@ tags: - pagination - filters - url -version: '1.0' +version: "1.0" description: >- Manage URL query parameters with useSearchParams - handle pagination, filters, and search state directly in the URL query string. --- -Retrieves a tuple containing a reactive object to read the current location's query parameters and a method to update them. -The object is a proxy so you must access properties to subscribe to reactive updates. -Note values will be strings and property names will retain their casing. - -The setter method accepts an object as an input, and its key-value pairs will be merged into the existing query string. -If a value is `''`, `undefined` or `null`, the corresponding key will be omitted from the resulting query string. -The updates behave like navigation and will not scroll the page to the top. -Additionally, the setter can take an optional second parameter, the same as `navigate`, to control the navigation behavior and auto-scrolling, which are disabled by default. - -```js -const [searchParams, setSearchParams] = useSearchParams(); - -return ( -