Created
September 7, 2017 21:34
-
-
Save mcallegari10/76b52c853a673b1eb3fb9ba27007cae1 to your computer and use it in GitHub Desktop.
React Chat Widget 4
This file contains 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
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