Commit c277a2ed authored by Alexander Kotov's avatar Alexander Kotov

add messages component

parent 7e68f5d9
......@@ -2,7 +2,7 @@ import React, { Component } from 'react';
import './App.css';
import Header from './components/Header'
import Message from './components/Message';
import Messages from './components/Messages'
class App extends Component {
user = {
......@@ -29,11 +29,7 @@ class App extends Component {
return (
<div id="chat">
<Header user={this.user} />
<div id="messages">
<Message message={this.messages[0]} />
<Message message={this.messages[1]} />
<Message message={this.messages[2]} />
</div>
<Messages messages={this.messages} />
<form id="message-form" autocomplete="off">
<input type="text" name="message" />
<button type="submit">
......
import React from 'react'
export default ({ message }) => {
const Message = ({ message }) => {
return (
<div className="message">
<img src="" alt="" />
......@@ -11,4 +11,6 @@ export default ({ message }) => {
</div>
</div>
)
}
\ No newline at end of file
}
export default Message
\ No newline at end of file
import React from 'react'
import Message from './Message'
const Messages = (props) => {
return (
<div id="messages">
{ props.messages.map((m, i) => <Message key={i} message={m} />) }
</div>
)
}
export default Messages
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment