@yext/search-headless-react
Version:
The official React UI Bindings layer for Search Headless
29 lines (22 loc) • 1.1 kB
text/typescript
import { SearchHeadless, State } from '@yext/search-headless';
export * from '@yext/search-headless';
import * as React from 'react';
import React__default, { 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>): React__default.ReactElement;
declare const SearchHeadlessContext: React.Context<SearchHeadless>;
export { type SearchActions, SearchHeadlessContext, SearchHeadlessProvider, type SearchUtilities, type StateSelector, useSearchActions, useSearchState, useSearchUtilities };