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.

Set up a Provider component to encapsulate the application logic

Set up a Provider component to encapsulate the application logic

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

Set up a Provider component to encapsulate the application logic

- [Instructor] In this video, I'd like to show you how to set up a component provider to encapsulate the application logic. Something you should know is that every context object comes with one component, the provider. Actually it comes with two components. First, the provider that allows consuming components to subscribe to the context changes. It comes with one single prop, which is value that we use to pass data down to child components. Then you have the component consumer that let's subscribe to the context changes within a function component. So I'm going to show you how to set up a component provider and let me show you one quick example first. So let's say that you'd like to share across the application with multiple components, the same UI settings to apply the same styling and appearance. So we're going to set up a component provider and we're going to use the single prop value to pass data down to any child…

Contents