import React from 'react';

import ChatMessage from './ChatMessage.component';

const ChatWindow = (props) => {
    const chat = props.chat
        .map(m => <ChatMessage 
            key={Date.now() * Math.random()}
            user={m.senderName}
            message={m.text}
            sentAt={m.sentAt}
            />);

    return(
        <div>
            {chat}
        </div>
    )
};

export default ChatWindow