ReactifySearchProvider
Purpose
The ReactifySearchProvider component exposes a React Context with the data and state information used by the Reactify Search components and hooks.
Usage
The ReactifySearchProvider component must wrap all Reactify Search components and hooks.
A separate ReactifySearchProvider 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.
The mode field is used to define which search experience to use including search, collection and instant search.
import React from "react";
import { ReactifySearchProvider } from "@usereactify/search";
export const InstantSearch: React.FC = () => (
<ReactifySearchProvider
mode="instant-search"
shopifyPermanentDomain="usereactify-demo.myshopify.com"
market="7494533198" // optionally the ID of the Shopify market to use
>
<></>
</ReactifySearchProvider>
);import React from "react";
import { ReactifySearchProvider } from "@usereactify/search";
export const ExampleReactiveSearchProviderSearch: React.FC = () => (
<ReactifySearchProvider
mode="search"
shopifyPermanentDomain="usereactify-demo.myshopify.com"
market="7494533198" // optionally the ID of the Shopify market to use
>
<></>
</ReactifySearchProvider>
);Props
Last updated
Was this helpful?