Widgets <InstantSearch>

Description

<InstantSearch> is the root component of all React InstantSearch implementations. It provides all the connected components (aka widgets) a means to interact with the searchState.

Props

appId*
type: string 

Your Algolia application id.

apiKey*
type: string 

Your Algolia search-only API key.

indexName*
type: string 

Main index in which to search.

refresh
type: booleandefault: false

Flag to activate when the cache needs to be cleared so that the front-end is updated when a change occurs in the index.

algoliaClient
type: object 

Provide a custom Algolia client instead of the internal one.

onSearchStateChange
type: func 

Function to be called everytime a new search is done. Useful for URL Routing.

searchState
type: object 

Object to inject some search state. Switches the InstantSearch component in controlled mode. Useful for URL Routing.

createURL
type: func 

Function to call when creating links, useful for URL Routing.

resultsState
type: SearchResults|SearchResults[] 

Use this to inject the results that will be used at first rendering. Those results are found by using the findResultsState function. Useful for Server Side Rendering.

stalledSearchDelay
type: numberdefault: 200

The amount of time before considering that the search takes too much time. The time is expressed in milliseconds.

root
type: { Root: string|function, props: object } 

Use this to customize the root element. Default value: { Root: 'div' }

Requirements

You will need to have an Algolia account to be able to use this widget. Create one now.

Example usage

import React from 'react'; import { InstantSearch, SearchBox, Hits } from 'react-instantsearch/dom'; const App = () => ( <InstantSearch appId="latency" apiKey="6be0576ff61c053d5f9a3225e2a90f76" indexName="ikea" > <SearchBox /> <Hits /> </InstantSearch> );

CSS classes

This widget has no theming options.

Translation keys

This widget has no translations.