@yext/search-headless-react
Version:
The official React UI Bindings layer for Search Headless
29 lines (22 loc) • 1.07 kB
TypeScript
import { SearchHeadless, State } from '@yext/search-headless';
export * from '@yext/search-headless';
import * as react from 'react';
import { PropsWithChildren } from 'react';
type SearchActions = SearchHeadless;
declare function useSearchActions(): SearchActions;
type StateSelector<T> = (s: State) => T;
/**
* Returns the Search State returned by the map function.
* Uses "use-sync-external-store/shim" to handle reading
* and subscribing from external store in React version
* pre-18 and 18.
*/
declare function useSearchState<T>(stateSelector: StateSelector<T>): T;
type SearchUtilities = SearchHeadless['utilities'];
declare function useSearchUtilities(): SearchUtilities;
type Props = {
searcher: SearchHeadless;
};
declare function SearchHeadlessProvider(props: PropsWithChildren<Props>): JSX.Element;
declare const SearchHeadlessContext: react.Context<SearchHeadless>;
export { type SearchActions, SearchHeadlessContext, SearchHeadlessProvider, type SearchUtilities, type StateSelector, useSearchActions, useSearchState, useSearchUtilities };