chatkit-react-api
v0.0.3
Published
react and socket.io
Downloads
4
Maintainers
Readme
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
| Prop | Description | Default value | Type | | ------ | :-------------------: | :-------------: | :----: | | roomID | Sets Room ID(requied) | None | string | | roomName | Sets Room Name(requied) | None | string | | userID | Sets User ID(requied) | None | string | | userName | Sets User Name(requied) | None | string |
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);