May 2018
Intermediate to advanced
470 pages
13h 54m
English
The NewPost component added in the Newsfeed component will allow users to write a new post containing a text message and optionally an image:

The NewPost component will be a standard form with a Material-UI TextField and a file upload button as implemented in EditProfile, that takes the values and sets them in a FormData object to be passed in the call to the create fetch method on post submission.
mern-social/client/post/NewPost.js:
clickPost = () => { const jwt = auth.isAuthenticated() create({ userId: jwt.user._id }, { t: jwt.token }, this.postData).then((data) => { if (data.error) { this.setState({error: data.error}) ...Read now
Unlock full access