1.15.0 • Published 1 year ago
@algolia/recommend-react v1.15.0
@algolia/recommend-react
React package for Algolia Recommend.
Installation
All Recommend packages are available on the npm registry.
yarn add @algolia/recommend-react
# or
npm install @algolia/recommend-react
Usage
Import the FrequentlyBoughtTogether
and RelatedProducts
and use them in your parent component.
import React from 'react';
import {
FrequentlyBoughtTogether,
RelatedProducts,
} from '@algolia/recommend-react';
import recommend from '@algolia/recommend';
const recommendClient = recommend('YourApplicationID', 'YourSearchOnlyAPIKey');
const indexName = 'YOUR_INDEX_NAME';
function App({ currentObjectID }) {
// ...
return (
<div>
<FrequentlyBoughtTogether
recommendClient={recommendClient}
indexName={indexName}
objectIDs={[currentObjectID]}
itemComponent={({ item }) => {
return (
<pre>
<code>{JSON.stringify(item)}</code>
</pre>
);
}}
/>
<RelatedProducts
recommendClient={recommendClient}
indexName={indexName}
objectIDs={[currentObjectID]}
itemComponent={({ item }) => {
return (
<pre>
<code>{JSON.stringify(item)}</code>
</pre>
);
}}
/>
</div>
);
}
Continue reading our Getting Started guide.
Documentation
The documentation offers a few ways to learn about the Recommend library:
- Follow the Building your Recommend UI guide to display recommendations on your website.
- Refer to the API reference for a comprehensive list of parameters and options.
1.15.0
1 year ago
1.14.0
1 year ago
1.13.0
1 year ago
1.12.1
1 year ago
1.12.0
2 years ago
1.11.0
2 years ago
1.9.0
2 years ago
1.10.0
2 years ago
1.8.2
2 years ago
1.8.1
3 years ago
1.8.0
3 years ago
1.7.1
3 years ago
1.7.0
3 years ago
1.6.0
3 years ago
1.5.0
3 years ago
1.4.0
3 years ago
1.3.1
3 years ago
1.2.0
3 years ago
1.3.0
3 years ago
1.1.0
4 years ago
1.0.0
4 years ago
1.0.0-experimental.6
4 years ago
1.0.0-experimental.5
4 years ago
1.0.0-experimental.4
4 years ago
1.0.0-experimental.3
4 years ago