August 2017
Beginner
298 pages
7h 4m
English
The last part of the adding posts section is submitting the post. Here, we need to do two things: generate a UUID for the post and get the current date and time in the epoch timestamp format:
const date = new Date(); const epoch = (date.getTime()/1000).toFixed(0).toString();
The Submit button in the JSX is already set to call the this.submit() method when it is clicked. So, let's create the submit method of the AddPost class with the following code:
submit() { if(this.state.author ...Read now
Unlock full access