-
{
chats.map((chat) =>
No chat selected
import React from 'react'; import moment from 'moment'; import PM from './PM'; import MessageInput from './MessageInput'; export default class Chat extends React.Component { constructor(props) { super(props); this.state = { chats: [] }; } componentWillMount() { this.loadChat(this.props.match.params.user); } loadChat = (uname) => { const { hash } = this.props.visitor; this.setState({ chats: [] }); if (hash && uname) { fetch(`https://api.juick.com/pm?uname=${uname}&hash=${hash}`) .then(response => response.json()) .then(jsonResponse => { this.setState({ chats: jsonResponse }); }); } } render() { const { chats } = this.state; const uname = this.props.match.params.user; return (
No chat selected