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 (