What problem does it solve?
Integrating CometChat UI kit into an Astro app often fails because Astro server-renders by default, but CometChat React components require browser-only globals like window and document.
Core Features & Use Cases
- client:only React islands: Ensures every CometChat-rendering component uses client:only="react" to prevent server-render crashes.
- Provider-in-island setup: Shows how to mount CometChatProvider inside the React island so initialization and login occur in the browser context.
- Astro-specific CSS handling: Ensures the UI Kit CSS variables import stays inside the React component so styling reaches the island.
- Island communication patterns: Provides practical approaches (custom DOM events, Nanostores, URL-based state) to coordinate between multiple islands like a navbar and a chat drawer.
- Use case: You want a static-first Astro site with a messages page and a “Message” drawer that reliably works without window-not-defined build errors.
Quick Start
Ask to integrate CometChat into your Astro project by applying the client:only="react" rule, importing CometChat UI CSS inside the React components, and using a CometChatProvider mounted within each chat React island.