> ## Documentation Index
> Fetch the complete documentation index at: https://replyke-feat-push-rich-payload-fields.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Use Fetch User

# `useFetchUser`

## Overview

The `useFetchUser` hook is used to retrieve detailed information about a specific user within the current project by their user ID. This can be useful for displaying user profiles or fetching data for interactions.

## Usage Example

```tsx theme={null}
import { useFetchUser } from "@replyke/react-js";

function UserProfile({ userId }: { userId: string }) {
  const fetchUser = useFetchUser();

  const handleFetchUser = async () => {
    try {
      const user = await fetchUser({ userId });
      console.log("Fetched user details:", user);
    } catch (error) {
      console.error("Failed to fetch user details:", error.message);
    }
  };

  return <button onClick={handleFetchUser}>Fetch User</button>;
}
```

## Parameters & Returns

### Parameters

The hook returns a function that accepts an object with the following field:

<ParamField path="userId" type="string" required>
  The ID of the user to fetch.
</ParamField>

### Returns

The function resolves with a user object containing user details:

<ResponseField name="User" type="User">
  The details of the fetched user object.
</ResponseField>
