Skip to content
API/stringifySearch()

stringifySearch()

function
src/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 { stringifySearch } from '@qubeejs/react/tanstack-router';
function stringifySearch(search: Record<string, unknown>): string
Parameter Type Description
search Record<string, unknown> The search object, as the router holds it

The query string with its ?, or an empty string for an empty search

stringifySearch({ page: 2, tag: ['a', 'b'] }); // '?page=2&tag=a&tag=b'