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

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

User logout

User logout

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

Start my 1-month free trial

User logout

- We are now displaying the current user, but we need the ability to logout the user. Let's head back to auth dot JS, where we are placing the methods dealing with authentication and sign up. We'll add a new function named logout that will simply call the sign on method on Firebase. Firebase dot auth dot sign out. And please keep in mind that this returns a promise. Let's head over now to the header component, and we will add a button for the logout action. Let's give it some class names from semantic UI, UI secondary button and our own class logout, which we'll use to add some styles. Text will be logout and on click, we'll call a function, logout user. Let's create that function now. Logout user. For now it's an empty function. Let's head over to auth dot CSS, and add some CSS for this button. It's float right with the relative position and let's fix the position here. Heading back to the header…

Contents