Skip to main content
Daily React is small once the mental model clicks. This page is the model. The rest of the guides are applications of it.

From listeners to hooks

With plain daily-js, a call is a stream of events. You keep your own copy of call state and update it as events arrive:
Daily React keeps that state for you in an internal store and exposes it through hooks. The same logic becomes:
There are no listeners to register and none to tear down. When a participant joins or leaves, the store updates and any component reading useParticipantIds re-renders.

Hooks are selectors

Under the hood, Daily React stores call state in Jotai atoms and updates them as daily-js events fire. Each hook is a selector: it reads one slice of that store and subscribes your component to changes in that slice only. This is the single most important thing to internalize, because it drives both correctness and performance. Two hooks that read different slices re-render independently:

Read the smallest slice you need

Prefer the narrow hook over the broad one. Reading a whole participant object re-renders your component on every property change; reading a single property does not.
The same principle is why dedicated hooks exist for common slices:
The object-returning hooks useParticipant, useLocalParticipant, and useActiveParticipant are deprecated as of 0.17.0 in favor of the property-and-ID hooks above, precisely because returning whole objects causes broad re-renders. New code should use the narrow hooks.

Events become hook callbacks

You rarely call useDailyEvent directly, because most events already have a hook that exposes their state and an optional callback. Reach for the feature hook first: Drop down to useDailyEvent only for events without a dedicated hook. See Handling events for the rules.

Components own the DOM

Hooks give you state; two things in a call need to touch the DOM directly, and those are components:
  • DailyVideo attaches a participant’s video track to a <video> element.
  • DailyAudio plays remote audio, managing speaker slots and autoplay.
Keeping media in components means your render logic stays declarative: you map participant IDs to <DailyVideo> elements and never imperatively call el.srcObject = .... See Rendering media.

The escape hatch

Daily React does not wrap every daily-js method. When you need one that has no dedicated hook, get the call object with useDaily and call it directly:
useDaily returns the exact same DailyCall instance you would get from daily-js, so anything in the daily-js reference works here. The difference is that imperative calls do not re-render anything by themselves; the resulting events flow back through the store and re-render the hooks that read the affected state.

Putting it together

A Daily React component, in one breath: read the state you need with the narrowest hooks, render media with components, and use useDaily for the imperative actions that have no hook. Everything else, the subscriptions and the cleanup, is handled for you.

Next steps

The call object and provider

Creating, joining, and leaving.

Working with participants

The hooks that read participant state.

Handling events

When and how to use the event hooks.

Rendering media

Video and audio components.