October 2017
Intermediate to advanced
302 pages
7h 27m
English
We want to save the message text to the database, of course, but we also want to save a bit more information.
Our users need to be able to see who sent the message (preferably, an email address), and be able to navigate to their users/:id page. So, we need to save the email address of the author with the message as well as a unique user ID. Let's throw in a timestamp for good measure:
// App.jshandleSubmitMessage = msg => { const data = { msg, author: this.state.user.email, user_id: this.state.user.uid, timestamp: Date.now() }; // Send to database}
Here, we're taking advantage of the fact ...
Read now
Unlock full access