Skip to main content

useSearchQuery

This hook manages the search input value in page state. It provides the current search query and a setter to update it, typically used with the search input field.

Import

import { useSearchQuery } from '@appmaker-xyz/shopify';

Basic Usage

const { searchQuery, setSearchQuery } = useSearchQuery();

// Update the search input
setSearchQuery('red shoes');

Return Value

PropertyTypeDescription
searchQuerystringThe current search input value (defaults to empty string).
setSearchQueryFunctionUpdates the search input value in page state. Signature: (value: string) => void.