ResultStateProvider

Purpose

The ResultStateProvider component is used to display basic stats related to the search such as total results.

Usage

import React from "react";
import { ResultStateProvider } from "@usereactify/search";

export const Component: React.FC = () => {
  return (
    <ResultStateProvider
      render={(state) => <>Showing {state.resultStats.numberOfResults} results.</>}
    />
  );
};

Props

type ResultStateProviderProps = {
  /** Render method */
  render?: React.FC<{
    hits: {
      hidden: number;
      time: number;
      total: number;
      hits: Array<ElasticHit>;
    };
    resultStats: {
      hidden: number;
      numberOfResults?: number;
      promoted: number;
      time: number;
    };
  }>;
};

Last updated