Skip to main content
The components for displaying recommendations are part of React InstantSearch, starting with version 7.9.0. The Algolia JavaScript API client supports the Recommend API starting with version 4.23.2. With this, you can integrate recommendations seamlessly into your React InstantSearch app, without having to install additional packages.

Packages

Add the react-instantsearch and algoliasearch packages to your project, and remove the @algolia/recommend and @algolia/recommend-js packages:

Imports

Import the Recommend components from React InstantSearch:
React
Some imports are no longer available:
  • The useRecommendations Hook
  • The Recommend context provider
For more information, see Components and Hooks.

Usage

Recommend widget must be children of the InstantSearch component. Pass the API client and name to the InstantSearch component:
React

Components

Changes for FrequentlyBoughtTogether

Move recommendClient and indexName to InstantSearch

The FrequentlyBoughtTogether component no longer needs recommendClient and indexName props. Instead, pass a searchChlient and the ìndexName to InstantSearch.
React

Replace children and view with the layoutComponent prop or the useFrequentlyBoughtTogether Hook

The FrequentlyBoughtTogether component no longer provides children and view props. To fully customize the UI, use either the layoutComponent prop or the useFrequentlyBoughtTogether Hook instead.
Layout
Hook

Replace fallbackComponent with emptyComponent

The emptyComponent prop replaces the fallbackComponent prop.
React

Replace maxRecommendations with limit

The limit prop replaces the maxRecommendations prop.
React

Remove environment

The environment prop is no longer needed.
React

Replace classNames

The classNames keys have changed.
React

Changes for RelatedProducts

Move recommendClient and indexName to InstantSearch

The RelatedProducts component no longer needs recommendClient and indexName props. Instead, pass a searchChlient and the ìndexName to <InstantSearch>.
React

Replace children and view with the layoutComponent prop or the useRelatedProducts() Hook

The RelatedProducts component no longer provides children and view props. To fully customize the UI, use either the layoutComponent prop or the useRelatedProducts Hook instead.
Layout
Hook

Replace fallbackComponent with emptyComponent

The emptyComponent prop replaces the fallbackComponent prop.
React

Replace maxRecommendations with limit

The limit prop replaces the maxRecommendations prop. The RelatedProducts component now takes an optional maxRecommendations prop which replaces limit.
React

Remove environment

The environment prop is no longer needed.
React

Replace classNames

The classNames keys have changed.
React

Changes for TrendingItems

Move recommendClient and indexName to InstantSearch

The TrendingItems component no longer needs recommendClient and indexName props. Instead, pass a searchChlient and the ìndexName to InstantSearch.
React

Replace children and view with the layoutComponent prop or the useTrendingItems() Hook

The TrendingItems component no longer provides children and view props. To fully customize the UI, use either the layoutComponent prop or the useTrendingItems Hook instead.
Layout
Hook

Replace fallbackComponent with emptyComponent

The emptyComponent prop replaces the fallbackComponent prop.
React

Replace maxRecommendations with limit

The limit prop replaces the maxRecommendations prop.
React

Remove environment

The environment prop is no longer needed.
React
Replace classNames
The classNames keys have changed.
React

Changes for TrendingFacets

Move recommendClient and indexName to InstantSearch

The TrendingFacets component no longer needs recommendClient and indexName props. Instead, pass a searchClient and the indexName to InstantSearch.
React

Replace children and view with the useTrendingFacets() Hook

The TrendingFacets component no longer provides children and view props. To fully customize the UI, use the useTrendingFacets Hook instead.

Replace fallbackComponent with emptyComponent

The emptyComponent prop replaces the fallbackComponent prop.
React

Replace maxRecommendations with limit

The limit prop replaces the maxRecommendations prop.
React

Remove environment

The environment prop is no longer needed.
React

Replace classNames

The classNames keys have changed.
React

Changes for LookingSimilar

Move recommendClient and indexName to InstantSearch

The LookingSimilar component no longer needs recommendClient and indexName props. Instead, pass a searchChlient and the ìndexName to InstantSearch.
React

Replace children and view with the layoutComponent prop or the useLookingSimilar() Hook

The LookingSimilar component no longer provides children and view props. To fully customize the UI, use either the layoutComponent prop or the useLookingSimilar Hook instead.
Layout
Hook

Replace fallbackComponent with emptyComponent

The emptyComponent prop replaces the fallbackComponent prop.
React

Replace maxRecommendations with limit

The limit prop replaces the maxRecommendations prop.
React

Remove environment

The environment prop is no longer needed.
React

Replace classNames

The classNames keys have changed.
React

Hooks

Changes for useFrequentlyBoughtTogether

Move recommendClient and indexName to InstantSearch

The useFrequentlyBoughtTogether Hook no longer needs recommendClient and indexName props. Instead, pass a searchChlient and the ìndexName to InstantSearch.
React

Replace recommendations with items

The useFrequentlyBoughtTogether Hook returns recommendations under the items key instead of recommendations.
React

Changes for useRelatedProducts

Move recommendClient and indexName to InstantSearch

The useRelatedProducts Hook no longer needs recommendClient and indexName props. Instead, pass a searchChlient and the ìndexName to InstantSearch.
React

Replace recommendations with items

The useRelatedProducts Hook returns recommendations under the items key instead of recommendations.
React

Changes for useTrendingItems

Move recommendClient and indexName to InstantSearch

The useTrendingItems Hook no longer needs recommendClient and indexName props. Instead, pass a searchChlient and the ìndexName to InstantSearch.
React

Replace recommendations with items

The useTrendingItems Hook returns recommendations under the items key instead of recommendations.
React

Changes for useTrendingFacets

Move recommendClient and indexName to InstantSearch

The useTrendingFacets Hook no longer needs recommendClient and indexName props. Instead, pass a searchClient and the indexName to InstantSearch.
React

Replace recommendations with items

The useTrendingFacets Hook returns recommendations under the items key instead of recommendations.
React

Changes for useLookingSimilar

Move recommendClient and indexName to InstantSearch

The useLookingSimilar Hook no longer needs recommendClient and indexName props. Instead, pass a searchChlient and the ìndexName to InstantSearch.
React

Replace recommendations with items

The useLookingSimilar Hook returns recommendations under the items key instead of recommendations.
React

Alternative for useRecommendations

The useRecommendations Hook isn’t available in React InstantSearch. Instead, use the dedicated Hooks for each Recommend model.

Remove Recommend context provider

The Recommend context provider is no longer necessary to batch requests. Remove it from your implementation.
React

HorizontalSlider

The HorizontalSlider component is now available in React InstantSearch as the Carousel component. For Carousel props, check the API reference:
Last modified on July 9, 2026