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.
react-instantsearch
which exposes all UI widgets and re-exports all Hooks.react-instantsearch-core
which only exposes all Hooks. You only need this package if you’re using React InstantSearch with React Native.
The code examples on this page use the React InstantSearch library with the
algoliasearch/lite
client,
which is smaller but doesn’t support indexing your data.
To perform indexing operations, import the regular algoliasearch
client.Install React InstantSearch as an npm package
If you’re using a package manager and a build tool, you can install React InstantSearch from npm. For the web:React
InstantSearch
is the root React InstantSearch component.
All widgets must be wrapped within it
In a production environment, secure your API keys as environment variables.
Include React InstantSearch with a CDN
If you don’t use a package manager and a build tool, you can include React InstantSearch directly from the jsDelivr CDN.HTML
jsDelivr is a third-party CDN. Algolia can’t provide support for such third-party services.
ReactInstantSearch
object on the global window
object.
React
InstantSearch
is the root React InstantSearch component.
All widgets must be wrapped within it.
In a production environment, you should secure your API keys as environment variables.
Send click and conversion events
Capturing real-time user interactions as events gives you actionable insights via click and conversion metrics, and they help you increase your customer engagement and conversions. Events are used to activate Algolia features and products like NeuralSearch, Dynamic Re-Ranking, Query Categorization, Recommend, and Personalization. To send click and conversion events when users interact with your search UI, set theinsights
option to true
.
TypeScript support
These packages ship with TypeScript types:react-instantsearch
(v7)react-instantsearch-core
(v7)
react-instantsearch
(v6)react-instantsearch-core
(v6)react-instantsearch-dom
(v6)react-instantsearch-native
(v6)
If you have issues when using them, contact the DefinitelyTyped community.
react-instantsearch-dom-maps
package doesn’t ship with TypeScript types and doesn’t have any DefinitelyTyped definitions.
Browser support
Algolia supports the last two versions of the major browsers: Chrome, Edge, Firefox, Safari. To support Internet Explorer 11 you need polyfills for:Array.prototype.find
, Array.prototype.includes
, Promise
, Object.entries
, and Object.assign
.
The code samples in this documentation use a JavaScript syntax that isn’t natively supported by older browsers like Internet Explorer 11.
If your site needs to support older browsers, use a tool like Babel to make your code work in the browsers you target.