Skip to Content
Full-Stack React Projects - Second Edition
book

Full-Stack React Projects - Second Edition

by Shama Hoque
April 2020
Intermediate to advanced
716 pages
18h 55m
English
Packt Publishing
Content preview from Full-Stack React Projects - Second Edition

Adding an about description

To store the short description that's entered in the about field by a user, we need to add an about field to the user model in server/models/user.model.js:

about: {    type: String,    trim: true  }

Then, to get the description as input from the user, we need to add a multiline TextField to the EditProfile form and handle the value change the same way we did for the user's name input.

mern-social/client/user/EditProfile.js:

  <TextField     id="multiline-flexible"     label="About"     multiline     rows="2"     value={values.about}     onChange={handleChange('about')}  />

Finally, to show the description text that was added to the about field on the user profile page, we can add it to the existing profile view.

mern-social/client/user/Profile.js ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Full-Stack React Projects

Full-Stack React Projects

Shama Hoque
React Native - The Practical Guide

React Native - The Practical Guide

Academind by Maximilian Schwarzmüller GmbH

Publisher Resources

ISBN: 9781839215414Supplemental Content