Skip to content

Instantly share code, notes, and snippets.

@whitneyburton
Last active April 23, 2020 22:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whitneyburton/341a0642e690e02828164932627feba6 to your computer and use it in GitHub Desktop.
Save whitneyburton/341a0642e690e02828164932627feba6 to your computer and use it in GitHub Desktop.
const App = () => {
const [open, toggleOpen] = React.useState(true);
const toggleDemo = () => open ? toggleOpen(false) : toggleOpen(true);
// componentDidMount() {
// console.log('componentDidMount - rendered!');
// channel.sendMessage({
// text: 'Welcome to our customer chat with React Hooks tutorial!',
// });
// };
// componentWillUnmount() {
// console.log(`You have ${channel.state.messages.length} stored in local state. Goodbye!`);
// };
return (
<div className={`wrapper ${open ? 'wrapper--open' : ''}`}>
<Chat client={chatClient} theme={'commerce dark'}>
<Channel channel={channel}>
<Window>
<ChannelHeader />
{open && (
<MessageList
typingIndicator={TypingIndicator}
Message={MessageCommerce}
/>
)}
<MessageInput Input={MessageInputFlat} />
</Window>
</Channel>
</Chat>
<Button onClick={toggleDemo} open={open} />
</div>
);
}
@ammark47
Copy link

Where is chatClient and TypingIndicator defined?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment