Home » Javascript » Twilio chat with react

Twilio chat with react

Posted by: admin June 30, 2018 Leave a comment

Questions:

Try to do chat with a react/redux client using **Twilio** chatjavascript SDK.`

I can create token then create a chat client but I can’t seem to invoke the getChannelByUniqueName('abc') and it gives 'undefined' chat client.

> let chatClient = new Chat(token);
> 
> // this is saying my chatClient is undefined // i need to find out if
> the channel existed yet then create or join
> chatClient.getChannelByUniqueName('abc'); 
> 
> // this seems to work though, so i don't understand var promise =
> chatClient.createChannel({   uniqueName: 'cde',  
> friendlyName:'testing',   isPrivate: true });
> 
> console.log(promise);

Yes, I have downloaded the sample SDK … I need this to be working in react/redux.

Answers: