1 00:00:00,900 --> 00:00:03,340 We've now got a working example using context. 2 00:00:03,360 --> 00:00:05,700 Now I can't say that enough like what we have right here. 3 00:00:05,700 --> 00:00:10,770 It works 100 percent and we could continue on with this code and everything would work out just fine. 4 00:00:11,220 --> 00:00:14,660 But I want to show you some more advanced techniques and what we have right here. 5 00:00:14,700 --> 00:00:18,750 So what I'm about to show you and what we're going to use inside of this application is 100 percent 6 00:00:18,780 --> 00:00:19,650 optional. 7 00:00:19,650 --> 00:00:24,540 We could continue down this path right here if we wanted to we could continue to make a couple more 8 00:00:24,720 --> 00:00:26,450 helper functions just like this one. 9 00:00:26,550 --> 00:00:32,670 We could make one called like const edits blog post and we could call that thing from our edit screen 10 00:00:33,060 --> 00:00:38,160 we could create another one called delete blog post and we could call that from our delete screen and 11 00:00:38,160 --> 00:00:44,010 so on and we can pass each of these additional functions down inside this value prop and then make them 12 00:00:44,010 --> 00:00:46,590 available to the different screens we create inside our application. 13 00:00:46,650 --> 00:00:50,240 So again is 100 percent a valid solution. 14 00:00:50,270 --> 00:00:53,370 We're going to show you a slightly different way of doing things. 15 00:00:53,430 --> 00:00:53,780 OK. 16 00:00:53,820 --> 00:00:55,340 So here's the thing. 17 00:00:55,620 --> 00:01:00,240 If we wanted to add in some additional screens here like we just mentioned we would have to create those 18 00:01:00,240 --> 00:01:05,690 separate helper functions for each additional screen one for deleting the list of blog posts or asking 19 00:01:05,700 --> 00:01:10,650 me deleting a blog post one for editing one for creating and so on. 20 00:01:10,650 --> 00:01:15,500 So maybe using this current approach would be a little bit tiresome rather quickly. 21 00:01:15,600 --> 00:01:20,310 You might recall that earlier on inside this course we spoke about an alternative way of managing a 22 00:01:20,310 --> 00:01:21,310 state object. 23 00:01:21,480 --> 00:01:24,480 And we did that using the use reducer hook. 24 00:01:24,660 --> 00:01:30,330 Remember that use reducer hook was all about using a switch statement with action objects and we use 25 00:01:30,330 --> 00:01:34,350 that thing to do different operations on some piece of state. 26 00:01:34,350 --> 00:01:38,670 So I'm thinking that rather than creating all these separate functions for each different thing that 27 00:01:38,670 --> 00:01:44,450 we're trying to do maybe we should try it creating a use reducer hook instead and have the use reducer 28 00:01:44,490 --> 00:01:48,540 hook manage our data so that's the idea. 29 00:01:48,680 --> 00:01:50,020 Again I can't say enough. 30 00:01:50,030 --> 00:01:55,610 I apologize for repeating what we have here is fine but we could alternatively improve it just a little 31 00:01:55,610 --> 00:01:59,710 bit by making use of the use reducer Hook instead. 32 00:01:59,760 --> 00:02:03,680 So then mind let's take another pause when we come back the next video we're going to start to refactor 33 00:02:03,680 --> 00:02:06,970 this code to make use of the use reducer instead. 34 00:02:07,010 --> 00:02:10,280 And we'll get a quick reminder on how that user reducer thing works as well.