Skip to main content
This is the React InstantSearch v7 documentation. If you’re upgrading from v6, see the upgrade guide. If you were using React InstantSearch Hooks, this v7 documentation applies—just check for necessary changes. To continue using v6, you can find the archived documentation.

About this widget

The trendingFacets widget isn’t part of React InstantSearch. If you need it, use the TrendingFacets component from the deprecated Recommend React library.

Examples

JavaScript
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}
    />
  );
}
I