You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
react-redux/js/components/app.js

25 lines
595 B

import React from 'react';
import CommentsList from './CommentsList.js';
import CommentsForm from './CommentsForm.js';
class App extends React.Component {
constructor(props){
super(props);
this.addComment = this.addComment.bind(this);
}
addComment(value){
this.state.comments.push({ body: value });
this.setState({
comments: this.state.comments
});
}
render() {
return <section>
<CommentsList/>
<CommentsForm handleSubmit={this.addComment}/>
</section>
}
}
export default App;