<Index>
About this component
<Index>
is the provider component for an Algolia index. It’s useful when you want to build an interface that targets multiple indices.
You can learn more about this federated search pattern in the guides on multi-index search.
The position of <Index>
in the widget tree impacts 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 algoliasearch from 'algoliasearch/lite';
import { InstantSearch, Index } from 'react-instantsearch-hooks-web';
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
|