cometchat-react-router-patterns

Guide React Router v6 and v7 integrations for CometChat with SSR-safe patterns.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill prevents common integration failures when wiring the CometChat React UI Kit into React Router applications by clarifying the correct patterns for v6 (library) versus v7 (framework with SSR).

Core Features & Use Cases

  • React Router mode detection: Identify whether you are in v6 library mode or v7 framework mode before applying the integration strategy.
  • Correct provider and rendering strategy: Place and initialize CometChatProvider appropriately and prevent SSR crashes in v7 by using client-only wrappers and dynamic imports.
  • Routing patterns for chat UX: Implement nested “conversation list + conversation view” layouts using Outlet (v6) or file-system nested routes (v7), including safe navigation from UI callbacks.

Quick Start

Ask the AI to detect your React Router mode and then outline the exact provider placement and nested route structure you should use to render CometChat conversations and message views without SSR errors.

Frequently Asked Questions about cometchat-react-router-patterns

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

FAQPage Schema
How do I integrate CometChat with React Router without breaking SSR?

To integrate CometChat safely, prevent SSR crashes by using client-only wrappers and dynamic imports for chat components, ensuring CometChat initializes only on the client side within your React Router application.

Does CometChat work with React Router v7 framework mode and file-system routes?

Yes, CometChat works with React Router v7 framework mode by using dynamic imports and ClientOnly wrappers to prevent server-side rendering crashes, while leveraging file-system nested routes for the chat layout.

What's the best way to structure nested conversation views using CometChat and React Router?

The best way to structure nested CometChat conversation views is by using Outlet nesting in React Router v6 or file-system nested routes in v7, creating a conversation list and conversation view layout.

How do I handle useNavigate inside CometChat UI Kit callbacks for routing?

You handle useNavigate inside CometChat callbacks by safely accessing the React Router navigation hook within your client-only chat components, allowing seamless routing transitions from UI Kit interactions.

Where should I mount CometChatProvider in a React Router v6 application?

You should mount CometChatProvider at the appropriate routing level in React Router v6 to ensure it wraps your chat components correctly, maintaining consistent state across nested conversation views.