InstantSearch / React / V6 / API reference

Stats | 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
<Stats
  // Optional parameters
  translations={object}
/>

About this widget

The Stats widget displays the total number of matching hits and the time it took to get them (time spent in the Algolia server).

Examples

1
2
3
import { Stats } from 'react-instantsearch-dom';

<Stats />

Props

translations

Optional
Type: object

A mapping of keys to translation values.

1
2
3
4
5
6
7
8
9
<Stats
  translations={{
    stats(nbHits, processingTimeMS, nbSortedHits, areHitsSorted) {
      return areHitsSorted && nbHits !== nbSortedHits
      ? `${nbSortedHits!.toLocaleString()} relevant results sorted out of ${nbHits.toLocaleString()} found in ${processingTimeMS.toLocaleString()}ms`
      : `${nbHits.toLocaleString()} results found in ${processingTimeMS.toLocaleString()}ms`
    },
  }}
/>
Did you find this page helpful?