/* Good practices: - name CSS classNamees like the associated component - prefix non-React method names by an "_" - pass a "key" attribute to elements in a loop State - direct reads, write through setState() - declare initial state in constructo() JSX: - "className", not "class" - knows how to render an array of JSX elements, not just one. */ const commentList = [ { id: 1, author: "Morgan McCircuit", body: "great picture!" }, { id: 2, author: "Bending Bender", body: "Excellent stuff" } ]; class Comment extends React.Component { render() { return (
); } } class CommentBox extends React.Component { constructor() { super(); this.state = { showComments: false }; } _getComments() { return commentList.map((comment) => { return (