Skip to main content

Overview

useFetchUserSuggestions returns a function that searches for users by a query string. This is the underlying hook used by useUserMentions for @mention autocomplete, but it can also be used for any user search or autocomplete UI.
This hook uses an authenticated request. The user must be signed in.

Usage Example

Parameters

The hook returns a function. That function accepts:
query
string
required
The search string. Matched against usernames and names.

Returns

User[]
array
An array of matching users’ public profiles. When spaceReputation is requested, each carries an added spaceReputation number. See User data model and Reputation.