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

# useScreenShare

> Returns a list of running screen shares and their states, along with helper methods that wrap daily-js screen share events.

`useScreenShare(params?): Object`

`useScreenShare` can also be used to set up optional callbacks for the `local-screen-share-started` and `local-screen-share-stopped` events.

## Parameters (optional)

An object with the following properties:

<ParamField body="onError" type="Function">
  Callback for the [`nonfatal-error` event with type `'screen-share-error'`](/reference/daily-js/events/error-events#screen-share-error).
</ParamField>

<ParamField body="onLocalScreenShareStarted" type="Function">
  Callback for the [`local-screen-share-started`](/reference/daily-js/events/media-events#local-screen-share-started) event.
</ParamField>

<ParamField body="onLocalScreenShareStopped" type="Function">
  Callback for the [`local-screen-share-stopped`](/reference/daily-js/events/media-events#local-screen-share-stopped) event.
</ParamField>

## Return value

An object with the following properties:

<ResponseField name="isSharingScreen" type="boolean">
  Indicates whether the local user is sharing a screen.
</ResponseField>

<ResponseField name="screens" type="Array">
  Array of screen share objects.

  <Expandable title="screens properties">
    <ResponseField name="audio" type="Object">
      Track state for associated `screenAudio`, see `tracks` [properties](/reference/daily-js/types/daily-track-state) for details.
    </ResponseField>

    <ResponseField name="local" type="boolean">
      Indicates if this is a local screen share.
    </ResponseField>

    <ResponseField name="screen_id" type="string">
      Unique identifier for the screen.
    </ResponseField>

    <ResponseField name="session_id" type="string">
      Unique identifier for the participant screen sharing.
    </ResponseField>

    <ResponseField name="video" type="Object">
      Track state for associated `screenVideo`, see `tracks` [properties](/reference/daily-js/types/daily-track-state) for details.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="startScreenShare" type="Function">
  See [`startScreenShare()`](/reference/daily-js/instance-methods/start-screen-share).
</ResponseField>

<ResponseField name="stopScreenShare" type="Function">
  See [`stopScreenShare()`](/reference/daily-js/instance-methods/stop-screen-share).
</ResponseField>

```json theme={null}
{
  "isSharingScreen": false,
  "screens": [{
    "audio": <Object>,
    "local": true,
    "screen_id": "25bfe2e4-3a3d-4c6f-b877-392ce7c998e4-screen",
    "session_id": "25bfe2e4-3a3d-4c6f-b877-392ce7c998e4",
    "video": <Object>,
  }],
  "startScreenShare": <Function>,
  "stopScreenShare": <Function>,
}
```

## Example

```jsx theme={null}
import { useScreenShare } from '@daily-co/daily-react';

export const UseScreenShareDemo = () => {
  const state = useScreenShare();

  return <div>Sharing Screen: {state?.isSharingScreen}</div>;
};
```

## See also

<CardGroup>
  <Card title="daily-js methods" icon="code" iconType="solid">
    * [startScreenShare()](/reference/daily-js/instance-methods/start-screen-share)
    * [stopScreenShare()](/reference/daily-js/instance-methods/stop-screen-share)
  </Card>

  <Card title="Events" icon="bolt" iconType="solid">
    * [local-screen-share-started](/reference/daily-js/events/media-events#local-screen-share-started)
    * [local-screen-share-stopped](/reference/daily-js/events/media-events#local-screen-share-stopped)
    * [nonfatal-error (screen-share-error)](/reference/daily-js/events/error-events#screen-share-error)
  </Card>
</CardGroup>
