import React from 'react'; import {ctx} from '../context.jsx' class Messages extends React.Component { constructor(props) { super(props) this.state = { dest: '', } } onSelectContact(contact_id) { const contact = this.context.contacts.find(c => c.id == contact_id) this.setState({ dest: contact.public_key, contact_id: contact_id }) } onSelectChat(chat_id) { this.setState({ chat_id: chat_id }) } render() { const { dest, contact_id, chat_id, text } = this.state const {messages, contacts, chats} = this.context const ready = contact_id && dest && text return (

Send Message


this.setState({dest: e.target.value})} />

this.setState({contact_id: e.target.value})} />

this.setState({chat_id: e.target.value})} />

this.setState({text:e.target.value})}/>

Messages

    {messages && messages.map(message => (
  1. {JSON.stringify(message, null, 2)}
  2. ))}
) } } Messages.contextType = ctx export default Messages