Created
September 2, 2021 17:29
-
-
Save hieptl/ed5f2a00802b727250cd76a8527dcfca to your computer and use it in GitHub Desktop.
App.js - Mention Chat App
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
useEffect(() => { | |
initCometChat(); | |
}, []); | |
/** | |
* init comet chat. | |
*/ | |
const initCometChat = async () => { | |
const { CometChat } = await import('@cometchat-pro/chat'); | |
const appID = `${process.env.REACT_APP_COMETCHAT_APP_ID}`; | |
const region = `${process.env.REACT_APP_COMETCHAT_REGION}`; | |
const appSetting = new CometChat.AppSettingsBuilder().subscribePresenceForAllUsers().setRegion(region).build(); | |
CometChat.init(appID, appSetting).then( | |
() => { | |
setCometChat(() => CometChat); | |
}, | |
error => { | |
} | |
); | |
} | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment