commerce/components/search/search-root.tsx
2023-08-11 15:42:00 +02:00

22 lines
550 B
TypeScript

import algoliasearch from 'algoliasearch/lite';
import { InstantSearch } from 'react-instantsearch';
const searchClient = algoliasearch(
`${process.env.NEXT_PUBLIC_ALGOLIA_APPLICATION_ID}`,
`${process.env.NEXT_PUBLIC_ALGOLIA_SEARCH_ONLY_API_KEY}`
);
interface SearchRootProps {
children: JSX.Element | JSX.Element[];
}
export default function SearchRoot({ children }: SearchRootProps) {
return (
<>
<InstantSearch searchClient={searchClient} indexName="shopify_products">
{children}
</InstantSearch>
</>
);
}