@widgetbot/react-embed
TypeScript icon, indicating that this package has built-in type declarations

1.9.0 • Public • Published

react-embed

CodeSandbox

import * as React from 'react'
import WidgetBot, { API } from '@widgetbot/react-embed'

class App extends React.Component {
  api: API

  onAPI(api: API) {
    this.api = api
    api.on('signIn', user => {
      console.log(`Signed in as ${user.name}`, user)
    })
  }

  handleClick() {
    this.api.emit('sendMessage', `Hello world! from \`@widgetbot/react-embed\``)
  }

  render() {
    return (
      <div>
        <button onClick={this.handleClick.bind(this)}>
          {`Send "Hello world"`}
        </button>
        <WidgetBot
          server="299881420891881473"
          channel="355719584830980096"
          onAPI={this.onAPI.bind(this)}
        />
      </div>
    )
  }
}

export default App

/@widgetbot/react-embed/

    Package Sidebar

    Install

    npm i @widgetbot/react-embed

    Weekly Downloads

    3,972

    Version

    1.9.0

    License

    MIT

    Unpacked Size

    44 kB

    Total Files

    14

    Last publish

    Collaborators

    • gm1003
    • johnythecarrot
    • victiondev
    • daave
    • advaithj