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.

Creating documents

Creating documents

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

Start my 1-month free trial

Creating documents

- [Man] Now that we have deployed our security rules, we can start writing and updating data in a collection. We will be creating our own users collection in cloud firestore where users will update their profile data. Let's head over now to config.js and let's go ahead and import firebase forward slash firestore. And we will export a new token here which will be the firestore service. We can grab that by calling the firestore method on firebase. The next one to do is to create a new function that will create a user document. Under the firebase folder here is create a new file called user.js. This file will hold functions that deal with updating user data. Let's go ahead and import our firestore service from forward slash config and we can create our new function called createUserDocument. It will take in a user object and here let's get a reference to the firestore document. Let's call this variable docRef and will call…

Contents