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

# useThrottledDailyEvent

> Registers daily-js event listeners.

`useThrottledDailyEvent(params): void`

Listeners are automatically torn down when the calling component or hook unmounts. Unlike [`useDailyEvent`](https://docs.daily.co/reference/daily-react/use-daily-event), the callback receives an array of all events accumulated during the throttle window. The queue is cleared when `daily-js` emits `'call-instance-destroyed'`.

## Parameters

**event** `string | string[]` *required*

The `daily-js` [event(s)](https://docs.daily.co/reference/daily-js/events.md) to register.

**callback** `Function` *required*

A memoized callback reference to run when the event(s) get emitted.

**throttleTimeout** `integer` (default: 100)

The minimum waiting time until the callback is called again.

> [!WARNING]
>
> The `callback` param has to be a memoized reference (e.g. via [`useCallback`](https://reactjs.org/docs/hooks-reference.html#usecallback)). Otherwise a console error might be thrown indicating a re-render loop.

## Return value

`void`

## Example

```jsx theme={null}
import { useThrottledDailyEvent } from '@daily-co/daily-react';
import { useCallback, useState } from 'react';

export const DailyEventDemo = () => {
  const [hasEmmaJoined, setHasEmmaJoined] = useState(false);

  useThrottledDailyEvent(
    'participant-joined',
    useCallback((evts) => {
      if (evts.some(({ participant }) => participant.user_name === 'Emma')) {
        setHasEmmaJoined(true);
      }
    }, [])
  );
  return <div>Is Emma there yet? {hasEmmaJoined ? 'Yes!' : 'No.'}</div>;
};
```

## Example for multiple events

```jsx theme={null}
import { useThrottledDailyEvent } from '@daily-co/daily-react';
import { useCallback, useState } from 'react';

export const DailyEventDemo = () => {
  const [count, setCount] = useState(0);
  useThrottledDailyEvent(
    ['participant-joined', 'participant-left'],
    useCallback((events) => {
      setCount((c) => {
        let i = c;
        events.forEach((event) => {
          switch (event.action) {
            case 'participant-joined':
              i++;
              break;
            case 'participant-left':
              i--;
              break;
          }
        });
        return i;
      });
    }, [])
  );
  return (
    <div>
      {count === 1
        ? 'There is 1 person in the call'
        : `There are ${count} people in the call.`}
    </div>
  );
};
```

## See also

> [card] Hooks
>
> * [useDailyEvent()](https://docs.daily.co/reference/daily-react/use-daily-event.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.