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
Import
JavaScript
About this widget
<Configure>
is a renderless component that lets you forward search parameters to Algolia.
Any prop you pass to this component is forwarded as a search parameter to Algolia.
Don’t make the widget itself conditional, for example, in a ternary statement.
Doing so creates an infinite loop.
You can also create your own UI with
useConfigure
.Examples
JavaScript
Props
A list of search parameters to enable.
JavaScript
Hook
React InstantSearch let you create your own UI for the<Configure>
widget with useConfigure
.
Hooks provide APIs to access the widget state and interact with InstantSearch.
The useConfigure
Hook accepts parameters and returns APIs.
It must be used inside the <InstantSearch>
component.
Usage
First, create your React component:JavaScript
JavaScript
Parameters
Hooks accept parameters. You can either pass them manually or forward props from a custom component.When passing functions to Hooks, ensure stable references to prevent unnecessary re-renders.
Use
useCallback()
for memoization.
Arrays and objects are automatically memoized.A list of search parameters to enable.
It returns an object with a
refine
function that you can use to replace the provided search parameters with new ones.JavaScript
APIs
Hooks return APIs, such as state and functions. You can use them to build your UI and interact with React InstantSearch.Replaces the provided search parameters with new ones.
JavaScript