0.0.1 • Published 4 years ago

react-chat-api-component-test v0.0.1

Weekly downloads
2
License
ISC
Repository
github
Last release
4 years ago

React Color Component

Status

Incompleted version

Installation

npm install --save react-chat-api-component-test

How To Use

First import this component where you want to use it

import {withChatkitOneToOne} from "react-chat-api-component-test"

Props

PropDescriptionDefault valueType
roomIDSets Room ID(requied)Nonestring
roomNameSets Room Name(requied)Nonestring
userIDSets User ID(requied)Nonestring
userNameSets User Name(requied)Nonestring

Example

import React from 'react';
import {withChatkitOneToOne} from 'react-chat-api-component-test';

function Chat(props) {
  const [message, setMessage] = React.useState('');
  function sendMessage() {
    const msgContent = {
        type: 'text',
        message: message
    }
    props.chatkit.sendSimpleMessage(msgContent)
  }
  function messageChange(e) {
    setMessage(e.target.value);
    props.chatkit.typeing();
  }
  React.useEffect(() => {
  }, [props])
  
  return (
    <div className="App">
        <input type="text" value={message} onChange={(e) => {messageChange(e)}} />
        <button onClick={sendMessage}>send</button>
    </div>
  );
}
export default withChatkitOneToOne(Chat);