> ## 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`](/reference/daily-react/use-daily) provides access to the call object instance passed to
  or managed by [`DailyProvider`](/reference/daily-react/daily-provider).
</Note>

## Parameters (optional)

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

<ParamField body="options" type="DailyFactoryOptions">
  Contains all factory properties that are passed to `createCallObject()`. Check [DailyCall properties](/reference/daily-js/types/daily-call-options) for details.
</ParamField>

<ParamField body="shouldCreateInstance" type="Function">
  Optional callback function with a boolean return to control when the call object instance should be created.
</ParamField>

## Return value

<ResponseField name="DailyCall" type="DailyCall">
  The [`DailyCall`](/reference/daily-js/daily-call-client) instance.
</ResponseField>

## 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

<CardGroup>
  <Card title="Hooks" icon="code" iconType="solid">
    * [useCallFrame()](/reference/daily-react/use-call-frame)
    * [useDaily()](/reference/daily-react/use-daily)
  </Card>

  <Card title="Components" icon="layout" iconType="solid">
    * [DailyProvider](/reference/daily-react/daily-provider)
  </Card>

  <Card title="daily-js methods" icon="code" iconType="solid">
    * [createCallObject()](/reference/daily-js/factory-methods/create-call-object)
  </Card>
</CardGroup>
