Overview
Using React UI Kit, you can integrate your Next.js application with CometChat.Pre-requisites
Please make sure you have a running Next.js app. Please follow the Next.js Documentation in case you do not have a Next.js app setup on your system.Install CometChat UI Kit
Please make sure you have installed the CometChat UI Kit by following the Integration documentation.Build Chat component
Please make sure you have installed the CometChat UI Kit by following the Integration documentation.- Let’s create a new file named chat.js inside the pages folder. And add the following code in the file.
Replace APP_ID, REGION, and AUTH_KEY with your CometChat App ID, Region and Auth Key in the below code. You can get these details from the CometChat Dashboard
- Create a file named
**consts.js**
where will keep the CometChat App Credentials. Place this file in the pages folder as well. And add the below code in the file.
- Now let us move to the most important part, rendering the CometChat UI Kit. Create a file named
**CometChatNoSSR.js**
component in your root folder
Replace UID in the below code.
- Now run the app using npm run dev & navigate to
localhost:3000/chat
. Change the port to the port on which the app is running.