You can preview the experience:
- Open the
cometchat-app-react
folder.- Add credentials for your app in
src/index.tsx
:
- Install dependencies:
- Run the app:
cometchat-app-react/src/CometChat
folder inside your src/app
directory.
CometChatNoSSR.tsx
UID
. You can either:
cometchat-uid-1
cometchat-uid-2
cometchat-uid-3
cometchat-uid-4
cometchat-uid-5
CometChatApp
component and specifically disable Server-Side Rendering (SSR) for CometChatNoSSR.tsx
. This targeted approach ensures the CometChat Visual Builder components load only on the client side, while the rest of your application remains fully compatible with SSR.
CometChatApp
component.CometChatNoSSR.tsx
: In this file, use dynamic imports with { ssr: false }
to disable SSR only for the CometChat component, preventing SSR-related issues but preserving SSR for the rest of your code.window
, document
, and WebSockets. Since Next.js renders on the server by default, we disable SSR for this component to avoid runtime errors.chatType = "user"
): Displays one-on-one chats only, either for a currently selected user or the default user.chatType = "group"
): Displays group chats exclusively, either for a currently selected group or the default group.tsConfig.json
:
CometChat
folder contains: