Skip to main content

useCurrentUser

Hook that returns the current user.

Usage

import React from 'react';
import { useCurrentUser } from '@availity/hooks';

const Example = () => {
const { data: user, isFetching } = useCurrentUser();

return <div>{isFetching ? 'Loading...' : user?.id}</div>;
};

Parameters

options?: QueryConfig

Options passed to the useQuery hook such as enabled and retry. See useQuery docs.

Return Value

Returns a UseQueryResult object from @tanstack/react-query. Key properties:

  • data — The current user object.
  • isFetchingboolean indicating if the request is in flight.
  • isErrorboolean indicating if an error occurred.