Skip to main content
This guide walks you through integrating the CometChat Calls SDK into a React application. By the end, you’ll have a working video call implementation with proper state management and lifecycle handling.

Prerequisites

Before you begin, ensure you have:
  • A CometChat account with an app created (Sign up)
  • Your App ID, Region, and API Key from the CometChat Dashboard
  • A React project (Create React App, Vite, or similar)
  • Node.js 16+ installed

Step 1: Install the SDK

Install the CometChat Calls SDK package:

Step 2: Initialize and Login

Create a provider component to handle SDK initialization and authentication. This ensures the SDK is ready before any call components render.

Step 3: Wrap Your App

Add the provider to your app’s root component:

Step 4: Create the Call Component

Build a call component that handles joining, controls, and cleanup:

Step 5: Use the Call Component

Create a page that uses the call component:

Custom Hook (Optional)

For more complex applications, extract call logic into a reusable hook:

TypeScript Support

The SDK includes TypeScript definitions. Here’s a typed version of the provider:
For more detailed information on specific topics covered in this guide, refer to the main documentation: