Skip to content

Instantly share code, notes, and snippets.

@mcallegari10
Last active February 6, 2018 15:07
Show Gist options
  • Save mcallegari10/45743cb70ed4fe6f54ee64436d259177 to your computer and use it in GitHub Desktop.
Save mcallegari10/45743cb70ed4fe6f54ee64436d259177 to your computer and use it in GitHub Desktop.
React Chat Widget 3
import React, { Component } from 'react';
import { Widget, addResponseMessage, addLinkSnippet, addUserMessage } from 'react-chat-widget';
import logo from './logo.svg';
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
}
render() {
return (
<div className="App">
<Widget
handleNewUserMessage={this.handleNewUserMessage}
profileAvatar={logo}
title="My new awesome title"
subtitle="And my cool subtitle"
/>
</div>
);
}
}
export default App;
@paulowoicho
Copy link

Hi! Can you please give me the steps to include this widget in my html page?

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