// Detailed description of issue.
I have inited SendBird with my key and I add sb.groupChannel?.addGroupChannelHandler to listen and receive a new message in the group. (I put it in useEffect) but i got undefined
// If problem, please fill out the below. If question, please delete.
// What version of the SDK are you using?
Welcome to the Sendbird community!
If you are getting
undefined when adding the group channel event handler in your React JS app, there could be a few possible reasons for this issue. Here are some suggestions to troubleshoot the problem:
- Make sure you have initialized the Sendbird Chat SDK properly before adding the event handler. Check if you have called the
SendbirdChat.init() method with the correct
modules parameters. Also, ensure that you have imported the necessary modules correctly.
- Verify that you have imported the
GroupChannelHandler class from the
@sendbird/chat/groupchannel module correctly. Double-check the import statement and ensure that the module is installed in your project.
- Check if the
sb.groupChannel object is defined before adding the event handler. It’s possible that the
sb.groupChannel object is not initialized properly or is not available at the time of adding the event handler. You can add a null check before adding the event handler to avoid any errors.
If the issue persists, please provide more details about your code implementation, including the initialisation process and where you are adding the event handler.