useCallObject

useCallObject(): DailyCall

This hook manages a call object instance. When manually managing call object instances in React, it's easy to run into issues, like Error: Duplicate DailyIframe instances are not allowed, specifically in React's Strict Mode. useCallObject() helps prevent that.

useCallObject creates and destroys a call object instance. useDaily provides access to the call object instance passed to or managed by DailyProvider.

Params (optional)

useCallObject accepts the same configuration options as createCallObject().

ParameterTypeDescription
optionsDailyFactoryOptionsContains all factory properties that are passed to createFrame(). Check DailyCall properties for details.
shouldCreateInstanceFunctionOptional callback function with a boolean return to control when the call frame instance should be created.

Return type

TypeDescription
DailyCallThe DailyCall instance.

Sample code

Related references