API Reference / React InstantSearch Hooks / useRelevantSort()

About this Hook

The useRelevantSort Hook isn’t currently available in React InstantSearch Hooks, but you can make it yourself using useConnector() along with connectRelevantSort.

Refer to the connectRelevantSort documentation for the full API reference.

Examples

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { useConnector } from 'react-instantsearch-hooks-web';
import connectRelevantSort from 'instantsearch.js/es/connectors/relevant-sort/connectRelevantSort';

export function useRelevantSort(props) {
  return useConnector(connectRelevantSort, props);
}

export function RelevantSort(props) {
  const {
    isVirtualReplica,
    isRelevantSorted,
    canRefine,
    refine,
  } = useRelevantSort(props);

  return <>{/* Your JSX */}</>;
}
Did you find this page helpful?