useDailyEvent

useDailyEvent(params): void

Registers daily-js event listeners. The listeners are automatically torn down when a component or hook calling useDailyEvent gets unmounted.

Params

ParameterRequiredTypeDescription
eventstringThe daily-js event to register
callbackFunctionA memoized callback reference to run when the event is emittedlistener

The callback param has to be a memoized reference (e.g. via useCallback). Otherwise a console error might be thrown indicating a potential re-render loop.

Return type

  • void

Sample code

Related references