SortBy

Purpose

The SortBy component is a wrapper for the useSortBy hook, it provides a simple way to access and render the sort options.

Usage

If a render method is not provided the built-in component for sorting will be rendered.

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

import { ExampleSortby } from "./ExampleSortBy";

export const Component: React.FC = () => {
  return (
    <SortBy
      render={ExampleSortby}
    />
  );
};

Props

type SortByProps = {
  /** Render method called once for all sort options */
  render?: React.FC<ReturnType<typeof useSortBy>>;
};

Last updated