React SDK

useSorting

useSorting provides getter and setter for sorting results.

Usage

setSorting expects a string, and that string must satisfy the following requirements:

  • There must be at least one record in the collection that has that field and its corresponding value.
  • The field's value must be an Integer, Float, Timestamp or a String.
  • It must follow the syntax of "${field}" for ascending order of that field and "-${field}" for the opposite

E.g. if your record contains a rating field, then passing "rating" to sort for items that have the lowest rating to highest, or "-rating" for highest to lowest.

Editable Example
Suggestions
    Powered by

      Loading...

      Anatomy

      useSorting returns an object containing the following properties:

      NameTypeDefaultDescription
      sortingsortingThe currently sorting mode.
      setSorting(order: string) => voidMethod to set sorting mode.

      Parameters

      NameTypeDefaultDescription