Writing something in the view

The add comment section in the Comments component will allow the signed-in user to type in the comment text:

It will contain an avatar with the user's photo and a text field, which will add the comment when the user presses the Enter key.

mern-social/client/post/Comments.js:

<CardHeader   avatar={<Avatar className={classes.smallAvatar}               src={'/api/users/photo/'+auth.isAuthenticated().user._id}/>}   title={<TextField             onKeyDown={this.addComment}             multiline             value={this.state.text}             onChange={this.handleChange('text')}             placeholder="Write something ..."             className={classes.commentField}             margin="normal"/>} className={classes.cardHeader} ...

Get Full-Stack React Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.