recommend
recommend copied to clipboard
doc(readme): announce InstantSearch compatibility
🙌 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.
import instantsearch from 'instantsearch.js';
import {
frequentlyBoughtTogether,
relatedProducts,
} from 'instantsearch.js/es/widgets';
import algoliasearch from 'algoliasearch/lite';
const searchClient = algoliasearch('YourApplicationID', 'YourSearchOnlyAPIKey');
instantsearch({
// No need for a recommendClient anymore
searchClient,
indexName,
}).addWidgets([
frequentlyBoughtTogether({
container: '#frequentlyBoughtTogether',
objectIDs: [currentObjectID],
}),
relatedProducts({
container: '#relatedProducts',
objectIDs: [currentObjectID],
}),
]);
import {
InstantSearch,
FrequentlyBoughtTogether,
RelatedProducts,
} from 'react-instantsearch';
import algoliasearch from 'algoliasearch/lite';
const searchClient = algoliasearch('YourApplicationID', 'YourSearchOnlyAPIKey');
function App() {
return (
<InstantSearch searchClient={searchClient} indexName={indexName}>
<FrequentlyBoughtTogether objectIDs={[currentObjectID]} />
<RelatedProducts objectIDs={[currentObjectID]} />
</InstantSearch>
);
}
FX-2846