Skip to content

Commit

Permalink
fix: update the readme of js/react packages (#186)
Browse files Browse the repository at this point in the history
Co-authored-by: Haroen Viaene <hello@haroen.me>
  • Loading branch information
raed667 and Haroenv authored Jun 3, 2024
1 parent 8a3b8cc commit 9b4f553
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
33 changes: 33 additions & 0 deletions packages/recommend-js/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,36 @@
> 🙌 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](https://www.algolia.com/doc/guides/algolia-recommend/upgrade/recommend-js/).
```js
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],
}),
]);
```

---
---
---

# `@algolia/recommend-js`

JavaScript package for [Algolia Recommend](https://www.algolia.com/doc/guides/algolia-ai/recommend/).
Expand Down
27 changes: 27 additions & 0 deletions packages/recommend-react/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
> 🙌 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](https://www.algolia.com/doc/guides/algolia-recommend/upgrade/recommend-react/).
```jsx
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>
);
}
```

---
---
---

# `@algolia/recommend-react`

React package for [Algolia Recommend](https://www.algolia.com/doc/guides/algolia-ai/recommend/).
Expand Down

0 comments on commit 9b4f553

Please sign in to comment.