Skip to content

Instantly share code, notes, and snippets.

@hieptlccc
Created October 7, 2022 13:25
Show Gist options
  • Save hieptlccc/51faa9db6fa05accfae3f74b06b6d853 to your computer and use it in GitHub Desktop.
Save hieptlccc/51faa9db6fa05accfae3f74b06b6d853 to your computer and use it in GitHub Desktop.
Facebook Clone React - index.js
import React from 'react';
import ReactDOM from 'react-dom';
import './styles/index.css';
import App from './App';
import { CometChat } from '@cometchat-pro/chat';
import { cometChat } from './app.config'
const appID = cometChat.APP_ID
const region = cometChat.REGION
const appSetting = new CometChat.AppSettingsBuilder()
.subscribePresenceForAllUsers()
.setRegion(region)
.build()
CometChat.init(appID, appSetting)
.then(() => {
ReactDOM.render(
<App />,
document.getElementById('root')
)
console.log('Initialization completed successfully')
})
.catch((error) => {
console.log('Initialization failed with error:', error)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment