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
From the course: Building Production-Ready React Apps: Setup to Deployment with Firebase
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…
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)
Start with Firebase Authentication and select the provider2m 57s
-
(Locked)
Google Cloud Platform: Create new credentials3m 17s
-
(Locked)
Authenticate and manage users from the application5m 46s
-
(Locked)
Manage the state with the Context API: Component Provider5m 3s
-
(Locked)
Manage the state with the Context API: Custom hook5m 34s
-
(Locked)
Subscribe components to the context changes: User connected4m 59s
-
(Locked)
Create new documents with the user connected5m 26s
-
(Locked)
Secure your data in Cloud Firestore and Cloud Storage5m 43s
-
(Locked)
-
-
-
-