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.
Signature
<Index
  indexName={string}
  // Optional props
  indexId={string}
/>

Import

JavaScript
import { Index } from "react-instantsearch";

About this widget

<Index> is the provider component for an Algolia index. It’s useful when building interfaces that target multiple indices such as federated searches. The position of <Index> in the widget tree affects which search parameters apply. Widgets that create search parameters forward them to their children <Index> widgets.

Examples

JavaScript
import React from "react";
import { liteClient as algoliasearch } from "algoliasearch/lite";
import { InstantSearch, Index } from "react-instantsearch";

const searchClient = algoliasearch("YourApplicationID", "YourSearchOnlyAPIKey");

function App() {
  return (
    <InstantSearch indexName="instant_search" searchClient={searchClient}>
      {/* Widgets */}
      <Index indexName="instant_search_demo_query_suggestions">
        {/* Widgets */}
      </Index>
    </InstantSearch>
  );
}

Props

indexName
string
required
The main index to search into.
JavaScript
<Index indexName="instant_search">{/* Widgets */}</Index>;
indexId
string
An identifier for the <Index> widget.Providing an indexId lets different <Index widgets target the same Algolia index. It’s helpful for routing. It lets you find the refinements that match an <Index> widget.
JavaScript
<Index
  // ...
  indexId="instant_search"
>
  {/* Widgets */}
</Index>;
I