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

# useCallObject

> This hook manages a call object instance.

`useCallObject(): DailyCall`

When manually managing call object instances in React, it's easy to run into issues like `Error: Duplicate DailyIframe instances are not allowed`, especially in [React's Strict Mode](https://react.dev/reference/react/StrictMode). `useCallObject()` handles that for you.

> [!NOTE]
>
> `useCallObject` creates and destroys a call object instance.
> [`useDaily`](https://docs.daily.co/reference/daily-react/use-daily) provides access to the call object instance passed to
> or managed by [`DailyProvider`](https://docs.daily.co/reference/daily-react/daily-provider).

## Parameters (optional)

`useCallObject` accepts the same configuration options as [`createCallObject()`](https://docs.daily.co/reference/daily-js/factory-methods/create-call-object).

**options** `DailyFactoryOptions`

Contains all factory properties that are passed to `createCallObject()`. Check [DailyCall properties](https://docs.daily.co/reference/daily-js/types/daily-call-options.md) for details.

**shouldCreateInstance** `Function`

Optional callback function with a boolean return to control when the call object instance should be created.

## Return value

**DailyCall** `DailyCall`

The [`DailyCall`](https://docs.daily.co/reference/daily-js/daily-call-client) instance.

## Example

```jsx theme={null}
import { useCallback, useRef } from 'react';
import { DailyProvider, useCallObject } from '@daily-co/daily-react';

export const UseCallObjectDemo = () => {
  const callRef = useRef(null);
  const callObject = useCallObject();
  return (
    <DailyProvider callObject={callObject}>
      <div ref={callRef} />
    </DailyProvider>
  );
};
```

## See also

> [card] Hooks
>
> * [useCallFrame()](https://docs.daily.co/reference/daily-react/use-call-frame.md)
> * [useDaily()](https://docs.daily.co/reference/daily-react/use-daily.md)

> [card] Components
>
> * [DailyProvider](https://docs.daily.co/reference/daily-react/daily-provider.md)

> [card] daily-js methods
>
> * [createCallObject()](https://docs.daily.co/reference/daily-js/factory-methods/create-call-object.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.