Tip: You can fork the sandbox, insert your CometChat credentials (App ID, Region, Auth Key.) in the code, and immediately preview how the UI and messages respond in real time.

Sidebar component which will render different conversations.
CometChatSelector folder inside your src/app directory and add the following files:
CometChatNoSSR.tsx & CometChatNoSSR.css files. Here, we will initialize the CometChat UI Kit, log in a user, and build the messaging experience using CometChatMessageHeader, CometChatMessageList, and CometChatMessageComposer components.
CometChatNoSSR.tsx in Next.jsCometChatNoSSR.tsx while keeping the rest of the application’s SSR functionality intact. This ensures that the CometChat UI Kit components load only on the client-side, preventing SSR-related issues.
index.tsxindex.tsx file to dynamically import the CometChatNoSSR.tsx component with { ssr: false }.
{ ssr: false }, we ensure that CometChatNoSSR.tsx only loads on the client.