API/stringifySearch()
stringifySearch()
functionsrc/utils/plain-search.ts1 parameter
Write a search object as a plain query string, for the stringifySearch option of a TanStack
Router — the other half of parseSearch.
A list is written as a repeated name, undefined and null are left out, and a value that is
not text — a number, a boolean, an object — is written as its JSON.
Import
Section titled “Import”import { stringifySearch } from '@qubeejs/react/tanstack-router';Signature
Section titled “Signature”function stringifySearch(search: Record<string, unknown>): stringParameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
search |
Record<string, unknown> |
The search object, as the router holds it |
Returns
Section titled “Returns”The query string with its ?, or an empty string for an empty search
Example
Section titled “Example”stringifySearch({ page: 2, tag: ['a', 'b'] }); // '?page=2&tag=a&tag=b'