-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
44 lines (39 loc) · 1.4 KB
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import Header from './components/header';
import MessageList from './components/message-list';
import MessageInput from './components/message-input';
import { connect, userStore, roomStore } from './stores';
import './App.css';
class App extends Component {
render() {
const { userStore, roomStore } = this.props;
return (
<div className="App">
<Header
currentUser={ userStore.state.currentUser }
peersCount={ roomStore.state.peersCount }
login={ userStore.login }
logout={ userStore.logout } />
<div className="App-room">
<MessageList
messages={ roomStore.state.messages }
verifyMessage={ roomStore.verifyMessage }
currentUser={ userStore.state.currentUser }
className="App-messageList" />
<MessageInput
currentUser={ userStore.state.currentUser }
sendMessage={ roomStore.sendMessage } />
</div>
</div>
);
}
}
App.propTypes = {
userStore: PropTypes.object.isRequired,
roomStore: PropTypes.object.isRequired,
};
export default connect({
userStore,
roomStore,
})(App);