浏览代码

render comments on submit

Lucas Stadler 11 年之前
父节点
当前提交
bde08d37cd
共有 1 个文件被更改,包括 7 次插入2 次删除
  1. 7 2
      js/react/entry.js

+ 7 - 2
js/react/entry.js

@ -56,11 +56,16 @@ class CommentBox extends React.Component {
56 56
	constructor(props) {
57 57
		super(props);
58 58
		this.state = {data: []}
59
60
		this.handleCommentSubmit = this.handleCommentSubmit.bind(this);
59 61
	}
60 62
61 63
	handleCommentSubmit(comment) {
62
		// TODO: Send to server and rerender
63
		console.log("Got a comment: ", comment);
64
		let comments = this.state.data;
65
		let newComments = comments.concat([comment]);
66
		this.setState({data: newComments});
67
68
		// TODO: Send to server
64 69
	}
65 70
66 71
	componentDidMount() {