React package for Algolia Recommend.
npm install @algolia/recommend-react> 🙌 From now on you can use Algolia Recommend from InstantSearch, simplifying your integration between the two libraries!
>
> Learn how to migrate following the upgrade guide.
``jsx
import {
InstantSearch,
FrequentlyBoughtTogether,
RelatedProducts,
} from 'react-instantsearch';
import algoliasearch from 'algoliasearch/lite';
const searchClient = algoliasearch('YourApplicationID', 'YourSearchOnlyAPIKey');
function App() {
return (
);
}
`
---
---
---
React package for Algolia Recommend.
All Recommend packages are available on the npm registry.
`bash`
yarn add @algolia/recommend-reactor
npm install @algolia/recommend-react
Import the FrequentlyBoughtTogether and RelatedProducts and use them in your parent component.
`JSX
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 (
{JSON.stringify(item)}
{JSON.stringify(item)}
Continue reading our Getting Started guide.
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.