Search for users in your groups

Ask the Community

Filter users down using various options


Overview #

This method allows searching for users with various options. Using the searchQuery will filter users by what their name start with.
React:
// Will return a list of users starting with 'al';
import { user } from '@cord-sdk/react';

const searchResults = useSearchUsers({ searchQuery: 'al', groupID: 'my-group-id'});

return (
  <div>
     {!searchResults && "Loading..."}
     {searchResults &&
       searchResults.users.map((user) => (
         <div key={user.id}>
           <p>User name: {user.name}</p>
          </div>
       ))}
  </div>
);
Vanilla JavaScript:
// Will return a list of users with names beginning with 'al'
await window.CordSDK.user.searchUsers({ searchQuery: 'al', groupID: 'my-group-id'});
// Will return a list of users starting with 'al';
import { user } from '@cord-sdk/react';

const searchResults = useSearchUsers({ searchQuery: 'al', groupID: 'my-group-id'});

return (
  <div>
     {!searchResults && "Loading..."}
     {searchResults &&
       searchResults.users.map((user) => (
         <div key={user.id}>
           <p>User name: {user.name}</p>
          </div>
       ))}
  </div>
);
Copy

Available Data #

The API provides an object which has the following fields:


users #

ClientUserData[]

This is an array of objects, each of which has the following fields:

Show property details


What this function returns #

A promise that resolves to into an object with users which is a list of users in the group. This is a one time return.

Arguments this function takes #


options #

optional
ReactSearchUsersOptions

This is an object with the following fields:

Show property details


Not finding the answer you need? Ask our Developer Community

Ask Cordy