Skip to main content
This guide builds a single chat window — no sidebar, no conversation list. Users go directly into a one-to-one or group chat. Good for support chat, embedded widgets, or any focused messaging experience. This assumes you’ve already completed React Router Integration (project created, UI Kit installed, CSS imported).

What You’re Building

Three components stacked vertically:
  1. Chat header — displays recipient name, avatar, online status, and optional call buttons
  2. Message list — real-time chat history with scrolling
  3. Message composer — text input with media, emojis, and reactions

Step 1 — Create the CometChatNoSSR Component

This component handles init, login, fetches the target user/group, and renders the chat UI. It runs client-side only.
src
app
CometChatNoSSR
CometChatNoSSR.tsx
CometChatNoSSR.css
CometChatNoSSR.tsx
Key points:
  • CometChat.getUser(UID) fetches the user object from the SDK — you need a real user object, not a manually constructed one.
  • Pass either user or group to the message components, never both.
  • The highlighted lines show where to set your credentials.

Switching Between User and Group Chat

To load a group chat instead of one-to-one, replace the getUser call with getGroup:

Step 2 — Disable SSR and Add the Route

Create CometChat.tsx inside the routes folder:
routes/CometChat.tsx
Add the route:
routes.ts

Step 3 — Run the Project

Navigate to /chat (e.g. http://localhost:5173/chat). You should see the chat window load with the conversation for the UID you set.

Next Steps

Theming

Customize colors, fonts, and styles to match your brand

Components Overview

Browse all prebuilt UI components

React Router Integration

Back to the main setup guide

Core Features

Chat features included out of the box