cometchat-react-patterns

Implement CometChat React UI Kit integration patterns for Vite or CRA apps.

Updated May 28, 2026
One-click install
npx skills add https://github.com/MAX5271/CometChat --skill cometchat-react-patterns-max5271
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cometchat-react-patterns
Source: https://github.com/MAX5271/CometChat/tree/main/.claude/skills/cometchat-react-patterns
Command: npx skills add https://github.com/MAX5271/CometChat --skill cometchat-react-patterns-max5271

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill prevents common integration failures by guiding you through wiring CometChat’s React UI Kit into a plain React (Vite or CRA) app without mis-initialization, broken routing, or layout bugs.

Core Features & Use Cases

  • Provider setup with React StrictMode guards: Ensures CometChatUIKit.init() and login don’t run twice during development mounts, avoiding duplicate WebSocket connections and “login request ends” errors.
  • Routing integration patterns: Shows how to attach a chat experience to React Router v6 (both createBrowserRouter and <Routes>/<Route> patterns) or handle apps with no router.
  • Layout + CSS integration: Covers the correct one-time import of @cometchat/chat-uikit-react/css-variables.css and highlights the flexbox minHeight: 0 / minWidth: 0 rules that prevent chat panels from overflowing the viewport.

Quick Start

Ask it to generate the React Vite/CRA integration plan for mounting CometChatProvider, wiring a /messages route to your chat page, and applying the required CSS import and flex layout constraints.

Frequently Asked Questions about cometchat-react-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix CometChat React UI Kit initializing twice in StrictMode?

To fix CometChat React UI Kit initializing twice in StrictMode, apply one-time init and login guards around the CometChatUIKit provider setup to prevent duplicate WebSocket connections and login request errors during development mounts.

How do I integrate CometChat with React Router v6 routes?

To integrate CometChat with React Router v6, mount the provider at the app root and wire a specific route like /messages to the chat page using either createBrowserRouter or standard Routes and Route components.

Why does my CometChat message list overflow the viewport in Vite?

CometChat message lists overflow the viewport in Vite when flexbox constraints are missing; applying minHeight zero and minWidth zero rules to your chat panels prevents the composer and message lists from breaking layout.

Do I need to import CometChat CSS variables manually in a CRA app?

Yes, you need to import CometChat CSS variables manually in a CRA app by importing the cometchat chat-uikit-react css-variables css file exactly once at the root level to ensure correct UI rendering.

What is the best way to mount CometChatProvider in a plain React app?

The best way to mount CometChatProvider in a plain React app is at the app root with one-time init guards and environment variables configured for Vite or CRA to safely handle routing and layout constraints.