clickSubmitComment()メソッドでは、テキストエリアのコメントテキストの配列にロジックを追加する必要がありますが、私はまだ教えてどのようにリンクを共有するか教えています。コメントを追加するjsx logic
comment.jsx:
import React from 'react';
export default class Comment extends React.Component {
constructor(props){
super(props);
}
render() {
const comment = this.props.comment.map((commentForm, index) => {
return <CommentForm key={index} {...commentForm}/>
});
return (
<div className="media-body">{comment}<br></br></div>
);
}
}
と、commentForm.jsx:
import React from 'react';
export default class CommentForm extends React.Component {
constructor(props){
super(props);
this.clickSubmitComment = this.clickSubmitComment.bind(this);
this.comments = [];
}
clickSubmitComment() {
textarea -> comments -> send props to comment.jsx and view?
}
render() {
return (
<div><textarea className="form-control" rows="3"></textarea><br></br>
<button type="submit" className="btn btn-primary" onClick={this.clickSubmitComment}>Submit</button></div>
);
}
}
あなたはとても残念、親コンポーネントすなわちコメント – duwalanise
はいはいにテキストエリアで書かれたテキストを渡すもしかして –