react widget chat code example
Example: react live chat widget
import React from 'react';import { Widget, addResponseMessage } from 'react-chat-widget'; import 'react-chat-widget/lib/styles.css'; function App() { useEffect(() => { addResponseMessage('Welcome to this awesome chat!'); }, []); const handleNewUserMessage = (newMessage) => { console.log(`New message incoming! ${newMessage}`); // Now send the message throught the backend API addResponseMessage(response); }; return ( <div className="App"> <Widget handleNewUserMessage={handleNewUserMessage} /> </div> );} export default App;