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: Component Provider

Manage the state with the Context API: Component Provider

- [Instructor] Like we did in a previous part, we want to learn to keep the logic and the presentation separate. So we use the popular solution of the context API that provides a way to share values without having to explicitly and manually pass data down from the parents to child components. So to complete this section with user authentication the goals will be to create first a context object, create a component provider and later to create a custom hook. So let's begin with first creating a new object, context object. And that's going to be a new directory because we're going to have more than one now. So this one I'm going to move inside. So this context file, I'm going to move inside this directory. I'm going to say move and it should update like, every reference that we make to this file. We should update because now it's going to be named differently, so, we're going to call it FirestoreContext, like so. And…

Contents