Provider
Purpose
The Provider component exposes a React Context with the data and state information used by the Reactify Search components and hooks.
Usage
The Provider component must wrap all Reactify Search components and hooks.
A separate Provider component should be used for each search area, most implementations will use three, one for the search page, a second for collection pages and a third for the instant search form. This prevents search content between shared between the three areas.
import React from "react";
import { Provider } from "@usereactify/search";
export const InstantSearch: React.FC = () => (
<Provider
instantSearch={true}
index="reactify-search"
shopifyPermanentDomain="reactify-apps.myshopify.com"
>
...
</Provider>
);import React from "react";
import { Provider } from "@usereactify/search";
export const SearchPage: React.FC = () => (
<Provider
index="reactify-search"
shopifyPermanentDomain="reactify-apps.myshopify.com"
>
...
</Provider>
);Props
Last updated
Was this helpful?