Skip to content

Instantly share code, notes, and snippets.

@mcallegari10
Created September 7, 2017 21:34
Show Gist options
  • Save mcallegari10/76b52c853a673b1eb3fb9ba27007cae1 to your computer and use it in GitHub Desktop.
Save mcallegari10/76b52c853a673b1eb3fb9ba27007cae1 to your computer and use it in GitHub Desktop.
React Chat Widget 4
import React, { Component } from 'react';
import { Widget, addResponseMessage } from 'react-chat-widget';
class App extends Component {
componentDidMount() {
addResponseMessage("Welcome to this awesome chat!");
}
handleNewUserMessage = (newMessage) => {
console.log(`New message incomig! ${newMessage}`);
// Now send the message throught the backend API
addResponseMessage(response);
}
render() {
return (
<div className="App">
<Widget
handleNewUserMessage={this.handleNewUserMessage}
/>
</div>
);
}
}
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment