Algolia DevCon
Oct. 2–3 2024, virtual.
UI libraries / React InstantSearch / Widgets

For now, this widget is only available in Recommend.js v1.

This is the React InstantSearch v7 documentation. React InstantSearch v7 is the latest version of React InstantSearch and the stable version of React InstantSearch Hooks.

If you were using React InstantSearch v6, you can upgrade to v7.

If you were using React InstantSearch Hooks, you can still use the React InstantSearch v7 documentation, but you should check the upgrade guide for necessary changes.

If you want to keep using React InstantSearch v6, you can find the archived documentation.

About this widget

The trendingFacets widget isn’t available in React InstantSearch. If you need to use it, please use the trendingFacets function from the deprecated Recommend JS library.

Examples

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { TrendingFacets } from '@algolia/recommend-react';
import { recommendClient as recommend } from '@algolia/recommend';

const recommendClient = recommend('YourApplicationID', 'YourSearchOnlyAPIKey');
const indexName = 'YOUR_INDEX_NAME';

function TrendingFacetItem({ item }) {
  return (
    <pre>
      <code>{JSON.stringify(item)}</code>
    </pre>
  );
}

function App({ facetName }) {
  // ...

  return (
    <TrendingFacets
      recommendClient={recommendClient}
      indexName={indexName}
      itemComponent={TrendingFacetItem}
      facetName={facetName}
    />
  );
}
Did you find this page helpful?