cometchat-react-router-patterns

Apply CometChat integration patterns for React Router v6 and v7 modes.

74|2|Updated Apr 3, 2026
One-click install
npx skills add https://github.com/cometchat/cometchat-skills --skill cometchat-react-router-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cometchat-react-router-patterns
Source: https://github.com/cometchat/cometchat-skills/tree/main/skills/cometchat-react-router-patterns
Command: npx skills add https://github.com/cometchat/cometchat-skills --skill cometchat-react-router-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides practical patterns to integrate CometChat with React Router across v6 library mode and v7 framework mode, guiding provider placement, route patterns, SSR safety, and nested messaging UIs.

Core Features & Use Cases

  • Detects and distinguishes v6 vs v7 integration modes to apply correct patterns.
  • Provides v6 library mode patterns: provider placement at the router level, route configuration via createBrowserRouter or JSX Routes, useNavigate in callbacks, and nested Outlet layouts.
  • Provides v7 framework mode patterns: ClientOnly wrappers to prevent SSR, dynamic imports for the CometChat UI kit, file-system routing, and the clientLoader pattern for browser-only data.

Quick Start

Follow the steps in the guide to add the CometChat provider and configure routes for your v6 or v7 app, then start your dev server.

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 v6 and v7?

CometChat React Router integration uses provider placement at the router level for v6 library mode and file-system routing with dynamic imports for v7 framework mode. It guides routing configurations and nested conversation layouts across both versions.

How do I prevent SSR errors when adding the CometChat UI kit to React Router?

Prevent SSR errors by wrapping the CometChat UI kit in ClientOnly components and using dynamic imports. This stops server-side execution of client-only code during React Router framework mode rendering.

Does CometChat support nested conversation layouts in React Router?

CometChat supports nested conversation layouts using Outlet layouts in v6 and file-system routing in v7. It provides patterns for provider placement and safe data loading within these nested route structures.

What's the best way to load browser-only data for CometChat in React Router v7?

Use the clientLoader pattern to load browser-only data for CometChat in React Router v7 framework mode. This enforces safe data loading practices and prevents server-side execution of client-only code.

Why does my CometChat integration fail during server-side rendering?

CometChat integration fails during SSR because client-only code executes on the server. Apply ClientOnly wrappers, environment handling, and CSS imports to safeguard server-side execution and ensure correct client rendering.

Can I use useNavigate in CometChat callbacks with React Router?

You can use useNavigate in CometChat callbacks within React Router v6 library mode. The integration pattern supports route configuration via createBrowserRouter or JSX Routes with proper callback handling.