-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtweet.js
More file actions
45 lines (40 loc) · 1.14 KB
/
Copy pathtweet.js
File metadata and controls
45 lines (40 loc) · 1.14 KB
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
45
import React from 'react';
import PureRenderMixin from 'react-addons-pure-render-mixin';
import {Card, CardActions, CardHeader, CardMedia, CardTitle, CardText} from 'material-ui/Card';
import FlatButton from 'material-ui/FlatButton';
import Paper from 'material-ui/Paper';
import Immutable from 'immutable';
export default class Tweet extends React.Component {
static propTypes = {
id: React.PropTypes.number,
text: React.PropTypes.string,
user: React.PropTypes.object
};
constructor(props) {
super(props);
this.shouldComponentUpdate = PureRenderMixin.shouldComponentUpdate.bind(this);
}
// shouldComponentUpdate(nextProps, nextState) {
// return Immutable.is(nextProps, this.props);
// }
render() {
const {id, text, user} = this.props;
console.log('Tweet Rendered');
const style = {
maxWidth: 400,
margin: 20,
display: 'inline-block'
};
return (
<Paper style={style} zDepth={4}>
<Card key={id}>
<CardHeader
title={user.name}
avatar={user.profile_image_url}
/>
<CardText>{text}</CardText>
</Card>
</Paper>
);
}
}