import React from 'react'; import { IndexContext } from '../lib/IndexContext'; import { InstantSearchContext } from '../lib/InstantSearchContext'; import { useInstantSearchApi } from '../lib/useInstantSearchApi'; import type { UseInstantSearchApiProps } from '../lib/useInstantSearchApi'; import type { UiState } from 'instantsearch.js'; export type InstantSearchProps< TUiState extends UiState = UiState, TRouteState = TUiState > = UseInstantSearchApiProps & { children?: React.ReactNode; }; export function InstantSearch< TUiState extends UiState = UiState, TRouteState = TUiState >({ children, ...props }: InstantSearchProps) { const search = useInstantSearchApi(props); if (!search.started) { return null; } return ( {children} ); }