From the course: React: Cloud-Powered Apps with Firebase

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Updating user documents, part 2

Updating user documents, part 2

From the course: React: Cloud-Powered Apps with Firebase

Start my 1-month free trial

Updating user documents, part 2

- [Instructor] Now that the form is being populated with the user document, we need to work on updating this data. Let's go ahead and add another piece of state, and as we hold the loading state, initial value will be false. We can go ahead and create a variable to hold the formClassname, ui big form, and if loading is true, we'll add the loading class otherwise just dependent empty string. And then go ahead and replace the Classname for the form, with our new variable. Heading over now to user.js, we'll go ahead and create a new function called update user document. And we'll take in a user object, where we could first get a reference to the firestore document. The calling the doc method on the firestore service, and then specifying the path here. Which will be /users/user.uid. We can, then, return the problem's return by calling the update method on that document. Let's head back to profile.js now, and we…

Contents