Skip to main content

Users

A shared package that exports queries, mutations, types, and utility functions for users.

Usage

The module has been imported into our root npm package. All you have to do is import it into your module.

import { User } from '@shared/users'

Exported Queries

useUsersQuery

Fetches a paginated list of users from the public-api users endpoint. You are able to pass an optional set of query params and optionally override the underlying UseQueryOptions.

const { data, isLoading } = useUsersQuery(queryParams)

useInfiniteUsersQuery

Fetches a paginated list of users from the public-api users endpoint. You are able to pass an optional set of query params and optionally override the underlying UseInfiniteQueryOptions. This hook should be used for components that require infinite scrolling.

const { data, isLoading, fetchNextPage, hasNextPage } = useInfiniteUsersQuery(
queryParams
)

getUsers

Fetches a paginated list of users from the public-api users endpoint. You are able to pass an optional set of query params and optionally override the underlying UseQueryOptions.

This is only to be used outside of React. If you are in React please use the hook.

  const { data } = getUsers(queryParams)

## Exported Types

| Type | Description |
| --------- | ---------------------------------------------- |
| `User` | `User resource returned by our public apis` |