Created
October 31, 2017 00:18
-
-
Save AntonioErdeljac/1ba5a0fa3598c0ef2e93f54b872933fe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
class Chat extends React.Component{ | |
constructor(props){ | |
super(props); | |
this.state = { | |
username: '', | |
message: '', | |
messages: [] | |
}; | |
} | |
render(){ | |
return ( | |
<div className="container"> | |
<div className="row"> | |
<div className="col-4"> | |
<div className="card"> | |
<div className="card-body"> | |
<div className="card-title">Global Chat</div> | |
<hr/> | |
<div className="messages"> | |
</div> | |
<div className="footer"> | |
<input type="text" placeholder="Username" value={this.state.username} onChange={ev => this.setState({username: ev.target.value})} className="form-control"/> | |
<br/> | |
<input type="text" placeholder="Message" className="form-control" value={this.state.message} onChange={ev => this.setState({message: ev.target.value})}/> | |
<br/> | |
<button className="btn btn-primary form-control">Send</button> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
); | |
} | |
} | |
export default Chat; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment