Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jul 19, 2019. It is now read-only.

Commit 2f1c151

Browse files
committed
Update example.js
1 parent 1b868e2 commit 2f1c151

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

public/scripts/example.js

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,30 +30,19 @@ var Comment = React.createClass({
3030

3131
var CommentBox = React.createClass({
3232

33-
updateState: function() {
34-
this.setState({
35-
data: store.comments
36-
})
33+
propTypes: {
34+
comments: React.PropTypes.array.isRequired
3735
},
3836

3937
handleCommentSubmit: function(comment) {
4038
actions.submitComment(comment);
4139
},
4240

43-
getInitialState: function() {
44-
return {data: []};
45-
},
46-
47-
componentDidMount: function() {
48-
store.subscribe(this.updateState);
49-
actions.loadCommentsFromServer();
50-
},
51-
5241
render: function() {
5342
return (
5443
<div className="commentBox">
5544
<h1>Comments</h1>
56-
<CommentList data={this.state.data} />
45+
<CommentList data={this.props.comments} />
5746
<CommentForm onCommentSubmit={this.handleCommentSubmit} />
5847
</div>
5948
);

0 commit comments

Comments
 (0)