From the course: Building Production-Ready React Apps: Setup to Deployment with Firebase

Unlock the full course today

Join today to access over 24,400 courses taught by industry experts.

Subscribe components to the context changes: User connected

Subscribe components to the context changes: User connected

- Now we want to allow the rest of the application and all other components to subscribe to the context changes. And we're going to do that with the same custom hook. For example, we want to update here and be able to display the avatar of the user connected. Okay. Also display the username. And finally allow only user who are connected to upload images. Meaning that we're going to update the security rules of the services of cloud Firestore and also cloud storage to authorize transactions only if the user is connected. So for the moment, we want to update the UI for every component, allow other components to subscribe to the context changes. Right here, so you're going to make sure that you can also add this one current user. And for example, we would like to update here and read the information of the username. And we're going to use that with useMemo. And let's make sure also that this is added to the scope. Okay…

Contents