useSearch
This hook manages the search query state and provides the search result count on the search page.
Import
import { useSearch } from '@appmaker-xyz/shopify';
Basic Usage
const { query, setQuery, suggestLoading, searchResultCount } = useSearch();
// Update the search query
setQuery('sneakers');
Return Value
| Property | Type | Description |
|---|---|---|
query | string | The current search query string. |
setQuery | Function | Updates the search query in page state. Signature: setQuery(query). |
suggestLoading | boolean | Whether search suggestions are loading. |
searchResultCount | number | Total count of products matching the search query. |