We're all down to our application so let's do a quick wrap up the whole highlight of this application
was without a doubt this context thing.
So remember we used this idea of context to share some information throughout our entire application.
We put this provider at the very roots of our application component hierarchy that then made some data
available to every single component that wanted to get access to it in order to create our context.
We created a separate file inside this context directory.
We then inside of create data context called react create context.
We then created a component that we called provider the provider right here was kind of a generic component
that we could use to manage many different types of resources.
The expectation was that our provider would manage some amount of state through the use reducer hook.
We then made that state plus a ton of different functions to modify that state's available to all of
our different child components.
Now one thing I wanna repeat here is that we did not have to create the create data context file.
We did not have to make this.
We could have put all this code just directly inside of blog context and not worried about making that
reusable create data context function.
But again inside of any real application you're ever going to work on.
I really expect that you're going to have many different types of resources you might have a list of
blog posts images comments all that kind of good stuff.
And so by creating this create data context function we just made it a lot easier to set up different
types of resources if we ever want to have some other kind of resource inside of our app.
We will make a new reducer.
We will make a couple of functions that will take the dispatch function and then dispatch an action
to update our data and then we'll pass all that stuff off to create data context.
And that gives us back our context object and our provider then to make use of these two things.
The provider will be used inside of our app dot J.S. file remember right here and our context object
will be used inside of any component.
For example the index screen that needs to somehow get access to that information.
Now one thing on mentioned really quickly just as a quick reminder it's entirely possible that if we
do have multiple different types of resources like let's say back inside of app dot J.S. we might have
to import multiple different things inside of here that we're called provider.
Some one might come from blog context and maybe another comes from a different resource that we set
up called comments context or whatever else.
If that's the case we would then have these duplicate provider names so we could just rename one with
provider as blog provider and same thing with comments as well we could say as comments provider.
And that's pretty much it.
We would then add in that second provider wrapping the existing one or inside of it.
It really doesn't matter.
So we could put in comments provider like so.
That's pretty much it.
I hope you enjoy putting together this application.
This is definitely a good experience of understanding how to manage application state using context
but this is a pretty simple application and I'm sure you're still curious about how to put together
some more complicated stuff so let's take a quick pause right here and start working on our next application
in the next video.