> ## Documentation Index
> Fetch the complete documentation index at: https://firebridge.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# useCallable

> The `useCallable` custom hook streamlines the process of invoking Firebase Cloud Functions from React applications. It simplifies making requests to cloud functions, providing an easy-to-use interface for sending requests and handling responses.

### Key Features

* **Easy Cloud Function Invocation**: Facilitates calling Firebase Cloud Functions with minimal setup.
* **Automatic Logging**: Integrates logging for each function call, improving debugging and monitoring.
* **Type-Safe Requests and Responses**: Supports generic typing for request bodies and expected responses, enhancing type safety.

## Usage

Import `useCallable` and create a callable function for your specific cloud function:

<CodeGroup>
  ```ts Web theme={null}
  import { useCallable } from '@firebridge/web'

  const useOnReviewBook = useCallable<OnReviewBookBody, OnReviewBookResult>(
    functions,
    'onReviewBook',
  )

  // Now, we can use this hook to post reviews.
  // For example:
  const onReviewBook = useOnReviewBook()
  onReviewBook({ bookId, body: 'This book is great!' })
  ```

  ```ts Native theme={null}
  import { useCallable } from '@firebridge/native'

  const useOnReviewBook = useCallable<OnReviewBookBody, OnReviewBookResult>(
    functions,
    'onReviewBook',
  )

  // Now, we can use this hook to post reviews.
  // For example:
  const onReviewBook = useOnReviewBook()
  onReviewBook({ bookId, body: 'This book is great!' })
  ```
</CodeGroup>
