import { Meta } from '@storybook/blocks';

<Meta title="SDK Hooks/useContentShareState" />

# useContentShareState

The `useContentShareState` hook returns the state related to content share status of a meeting session.

### Return Value

```javascript
{
  // The tile ID of the active content share
  tileId: number | null;

  // Whether the content share is paused
  paused: boolean;

  // Whether or not the local user is screen sharing
  isLocalUserSharing: boolean;

  // Whether or not the local user's content share is loading
  isLocalShareLoading: boolean;

  // The chime attendee ID of the sharing user
  sharingAttendeeId: string | null;
}
```

## Importing

```javascript
import { useContentShareState } from 'amazon-chime-sdk-component-library-react';
```

## Usage

The hook depends on the `ContentShareProvider`. If you are using `MeetingProvider`, it is rendered by default.

```jsx
import React from 'react';
import {
  MeetingProvider,
  useContentShareState,
} from 'amazon-chime-sdk-component-library-react';

const App = () => (
  <MeetingProvider>
    <MyChild />
  </MeetingProvider>
);

const MyChild = () => {
  const { isLocalUserSharing } = useContentShareState();

  return isLocalUserSharing ? <div>Sharing</div> : <div>Not sharing</div>;
};
```

### Dependencies

- `ContentShareProvider`
