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.
Displaying current user
From the course: React: Cloud-Powered Apps with Firebase
Displaying current user
- [Instructor] Now that we have implemented user signup, wanting to be able to display the currently authenticated user. It will also provide a better user experience if the user gets routed to a profile page where they can see their information. Let's do that now. But first, we need to be able to get the current authenticated session and be able to access that in any component. We will do so by leveraging react context. And then child components will leverage hooks to access the user session. Let's start by creating a new file under the firebase folder here and call it UserProvider.js. We will use this file to house the user context, a provider component, and also a hook to access a current user session. First let's import React. And then the useEffect, useState, and useContext hooks from react. Also let's import firebase from firebase/app. We can create our user context by calling React.createContext. Now…
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
-
-
-
-
Firebase Authentication setup3m 20s
-
Creating users6m 57s
-
(Locked)
Displaying current user7m 17s
-
(Locked)
Redirect user upon signup2m 30s
-
(Locked)
User logout3m 55s
-
(Locked)
User login4m 56s
-
(Locked)
Authenticated user redirect4m 38s
-
(Locked)
Challenge: Authentication redirect2m 30s
-
(Locked)
Solution: Authentication redirect2m 2s
-
-
-
-
-
-
-