React SDK

useAutocomplete

useAutocomplete provides result and method for the autocomplete pipeline.

Usage

Editable Example
​
Suggestions
    Site search by

    Autocomplete

    Editable Example
    ​
    Suggestions
      Site search by

      Anatomy

      useAutocomplete returns an object containing the following properties:

      NameTypeDefaultDescription
      suggestionsstring[][]An array of suggestions for the query.
      completionstringA string that is predicted by the pipeline base on the current query.
      search(q?: string) => voidFunction used to search for suggestions.
      searchingbooleanfalseA boolean that is true when the autocomplete is currently searching for the latest result.
      redirects{ [redirectQuery: string]: RedirectTarget }{}An object which maps a search string, redirectQuery, to possible redirect completions for that string. See the JS SDK for detailed object shape.

      Parameters

      NameTypeDefaultDescription