<Index>
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.
1
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
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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
|
type: string
Required
The main index to search into. |
||
Copy
|
|||
indexId
|
type: string
An identifier for the Providing an |
||
Copy
|