InstantSearch
/
React
/
V6
/
API reference
Jun 25, 2024
Hits | React InstantSearch V6 (Deprecated)
Deprecated content
This documentation is for a deprecated version of React InstantSearch.
Some features and settings may be missing or their usage may have changed.
Refer to the documentation for the
latest version of React InstantSearch for up-to-date information.
Signature
Signature
<Hits // Optional parameters hitComponent={function} />
About this widget
Use the hits
widget to display a list of results.
To configure the number of hits retrieved, use the HitsPerPage
widget or pass the hitsPerPage
prop to a Configure
widget.
For guidance on how to search across more than one index, read the multi-index search guide.
If there are no hits, you should display a message to users and clear filters so they can start over.
Examples
Copy
1
2
3
import { Hits } from 'react-instantsearch-dom';
<Hits />
Props
hitComponent
Optional
Type:
function
Renders each hit from the results. If not provided, the rendering defaults to displaying the hit in JSON format. The provided component is called with a hit
prop.
Copy
1
2
3
const Hit = ({ hit }) => <p>{hit.name}</p>;
<Hits hitComponent={Hit} />
Did you find this page helpful?