README
@algolia/react-recommendations
This is the repository packaging the Algolia Recommend React component as well as an Algolia Recommend demo.
During the beta of Algolia Recommend, this React component relies on an Algolia Index to retrieve the recommendations, and performs a regular Search API request to get the recommendations.
Install
npm install --save @algolia/react-recommendations@1.0.0-beta.9
Usage
import { Recommendations } from "@algolia/react-recommendations";
Props
Available props:
searchClient
: the Algolia API Client to usemodel
: the name of the Recommendation model to use (bought-together
orrelated-product
)indexName
: the name of the products indexobjectID
: the objectID of the product to get recommendations fromhitComponent
: the InstantSearch-compatibleHit
widget- (optional)
maxRecommendations
: the number of recommendations to retrieve (default: max recommendations available) - (optional)
facetFilters
: additional facet filters - (optional)
fallbackFilters
: additional filters to use as fallback should there not be enough recommendations - (optional)
analytics
: whether you want Search Analytics to be turned on or not (default:false
) - (optional)
clickAnalytics
: whether you want Click Analytics to be turned on or not (default:false
)
<Recommendations
searchClient={searchClient}
model={"related-products" | "bought-together"}
indexName={"your_source_index_name"}
objectID={currentObjectID}
hitComponent={Hit}
maxRecommendations={5}
facetFilters={[]}
fallbackFilters={[]}
analytics={true | false}
clickAnalytics={true | false}
/>
Development
To run this project locally, install the dependencies and run the local server:
yarn
yarn start
Open http://localhost:3000 to see your app.