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

Unlock the full course today

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

Manage the state with the Context API: Custom hook

Manage the state with the Context API: Custom hook

- [Instructor] So now we want to continue with the setup of first the authProvider, and next we want to then allow to wrap around this app component, the root component, so we can allow descending components, to access the global state and then subscribe to the context changes. So we're going to finish with the setup of this login method. So that's going to be signing, it's going to return it premise, and we're going to pass that current user. Meaning that the result of this premise, once this is fulfilled, will be passed as a value, a new value to current user. So then we're going to be able to update every descending component with the value of the user, current user, like so. And for sign out, it's going to be, actually let me check if it is also Auth. Yeah, it returns a premise, just wanted to check. Same, it's going to be then, and then here we're going to set this back to null. And just to tell the rest of the…

Contents