useCallFrame

useCallFrame(): DailyCall

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

Params (optional)

useCallFrame accepts the same configuration options as createFrame().

ParameterTypeDescription
parentElRefMutableRefObject<HTMLElement>If specified, Daily's iframe will be appended to the referenced element. Otherwise it will be appended as a child of document.body.
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