We've now got a working example using context.
Now I can't say that enough like what we have right here.
It works 100 percent and we could continue on with this code and everything would work out just fine.
But I want to show you some more advanced techniques and what we have right here.
So what I'm about to show you and what we're going to use inside of this application is 100 percent
optional.
We could continue down this path right here if we wanted to we could continue to make a couple more
helper functions just like this one.
We could make one called like const edits blog post and we could call that thing from our edit screen
we could create another one called delete blog post and we could call that from our delete screen and
so on and we can pass each of these additional functions down inside this value prop and then make them
available to the different screens we create inside our application.
So again is 100 percent a valid solution.
We're going to show you a slightly different way of doing things.
OK.
So here's the thing.
If we wanted to add in some additional screens here like we just mentioned we would have to create those
separate helper functions for each additional screen one for deleting the list of blog posts or asking
me deleting a blog post one for editing one for creating and so on.
So maybe using this current approach would be a little bit tiresome rather quickly.
You might recall that earlier on inside this course we spoke about an alternative way of managing a
state object.
And we did that using the use reducer hook.
Remember that use reducer hook was all about using a switch statement with action objects and we use
that thing to do different operations on some piece of state.
So I'm thinking that rather than creating all these separate functions for each different thing that
we're trying to do maybe we should try it creating a use reducer hook instead and have the use reducer
hook manage our data so that's the idea.
Again I can't say enough.
I apologize for repeating what we have here is fine but we could alternatively improve it just a little
bit by making use of the use reducer Hook instead.
So then mind let's take another pause when we come back the next video we're going to start to refactor
this code to make use of the use reducer instead.
And we'll get a quick reminder on how that user reducer thing works as well.