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
From the course: React: Cloud-Powered Apps with Firebase
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
(Locked)
Cloud Firestore intro1m 55s
-
(Locked)
Cloud Firestore setup1m 38s
-
(Locked)
Deploying security rules for Cloud Firestore5m 10s
-
(Locked)
Creating documents4m 17s
-
(Locked)
Displaying user document4m 31s
-
(Locked)
Updating user documents, part 13m 53s
-
(Locked)
Updating user documents, part 25m 22s
-
(Locked)
-
-
-
-
-