Skip to main content
Enable users to create new conversations with individual users or join existing groups in your React chat app.

Overview

The New Chat feature allows users to initiate conversations with other users or join group conversations, providing a seamless way to start new communications.
  • Allows users to initiate conversations with other users or join group conversations.
  • Enables users to expand their network, join group discussions, and create new chat threads without navigating through complex menus.
  • Your app will provide an intuitive interface for users to discover and connect with other users, join groups, and start new conversations with proper navigation and state management.

Prerequisites

  • React v18.2.0+
  • CometChat React UI Kit v6.1.0+
  • CometChat Chat SDK JavaScript v4.0.13+
  • Project setup with initialized CometChat credentials (App ID, Auth Key, Region)
  • TypeScript support (recommended)
  • User authentication and basic chat functionality implemented
  • User and group management components available

Components


Integration Steps

1. New Chat State Management Setup

File: CometChatHome.tsx
Manages the new chat view visibility and resets side components when opening new chat.

2. New Chat View Component Integration

File: CometChatHome.tsx
Conditionally renders the new chat view or message view based on application state.

3. New Chat View Implementation

File: CometChatHome.tsx

4. User Selection and Chat Creation

File: CometChatHome.tsx

Implementation Flow

  • Fetch Data / Available Users and Groups
File: CometChatHome.tsx
  • Load User/Group Data / Associated Information
File: CometChatHome.tsx
  • Create Conversation / Action Handler
File: CometChatHome.tsx
  • Live Updates / State Management
Files: CometChatHome.tsx, appReducer.ts

Customization Options

  • Override CSS styles
  • Configure tabs
  • Customize list UI
  • Add search
  • Handle group types
  • Adjust navigation

Filtering / Edge Cases

  • User availability
  • Group permissions
  • Duplicate chats prevention
  • Blocking logic
  • Membership checks
  • Empty states

Error Handling & State Management


Context-Specific Notes

  • Public vs private groups
  • Different state logic for user/group chats
  • Mobile responsiveness
  • Navigation flow control
  • Group type handling

Summary / Feature Matrix


Next Steps & Further Reading