1 00:00:00,680 --> 00:00:05,490 We're all down to our application so let's do a quick wrap up the whole highlight of this application 2 00:00:05,490 --> 00:00:08,000 was without a doubt this context thing. 3 00:00:08,030 --> 00:00:14,070 So remember we used this idea of context to share some information throughout our entire application. 4 00:00:14,070 --> 00:00:19,620 We put this provider at the very roots of our application component hierarchy that then made some data 5 00:00:19,650 --> 00:00:25,770 available to every single component that wanted to get access to it in order to create our context. 6 00:00:25,770 --> 00:00:29,450 We created a separate file inside this context directory. 7 00:00:29,700 --> 00:00:34,980 We then inside of create data context called react create context. 8 00:00:34,980 --> 00:00:40,770 We then created a component that we called provider the provider right here was kind of a generic component 9 00:00:40,890 --> 00:00:44,330 that we could use to manage many different types of resources. 10 00:00:44,370 --> 00:00:50,770 The expectation was that our provider would manage some amount of state through the use reducer hook. 11 00:00:50,790 --> 00:00:56,550 We then made that state plus a ton of different functions to modify that state's available to all of 12 00:00:56,550 --> 00:00:58,800 our different child components. 13 00:00:58,800 --> 00:01:03,770 Now one thing I wanna repeat here is that we did not have to create the create data context file. 14 00:01:03,810 --> 00:01:05,470 We did not have to make this. 15 00:01:05,580 --> 00:01:10,680 We could have put all this code just directly inside of blog context and not worried about making that 16 00:01:10,680 --> 00:01:13,560 reusable create data context function. 17 00:01:13,860 --> 00:01:17,290 But again inside of any real application you're ever going to work on. 18 00:01:17,370 --> 00:01:22,470 I really expect that you're going to have many different types of resources you might have a list of 19 00:01:22,470 --> 00:01:26,150 blog posts images comments all that kind of good stuff. 20 00:01:26,340 --> 00:01:31,380 And so by creating this create data context function we just made it a lot easier to set up different 21 00:01:31,380 --> 00:01:35,960 types of resources if we ever want to have some other kind of resource inside of our app. 22 00:01:36,060 --> 00:01:38,180 We will make a new reducer. 23 00:01:38,180 --> 00:01:43,080 We will make a couple of functions that will take the dispatch function and then dispatch an action 24 00:01:43,230 --> 00:01:50,050 to update our data and then we'll pass all that stuff off to create data context. 25 00:01:50,090 --> 00:01:55,270 And that gives us back our context object and our provider then to make use of these two things. 26 00:01:55,310 --> 00:02:02,650 The provider will be used inside of our app dot J.S. file remember right here and our context object 27 00:02:02,710 --> 00:02:04,560 will be used inside of any component. 28 00:02:04,570 --> 00:02:08,680 For example the index screen that needs to somehow get access to that information. 29 00:02:10,300 --> 00:02:14,210 Now one thing on mentioned really quickly just as a quick reminder it's entirely possible that if we 30 00:02:14,210 --> 00:02:19,670 do have multiple different types of resources like let's say back inside of app dot J.S. we might have 31 00:02:19,670 --> 00:02:23,630 to import multiple different things inside of here that we're called provider. 32 00:02:23,630 --> 00:02:28,690 Some one might come from blog context and maybe another comes from a different resource that we set 33 00:02:28,690 --> 00:02:31,990 up called comments context or whatever else. 34 00:02:32,180 --> 00:02:37,130 If that's the case we would then have these duplicate provider names so we could just rename one with 35 00:02:37,130 --> 00:02:45,850 provider as blog provider and same thing with comments as well we could say as comments provider. 36 00:02:45,850 --> 00:02:47,510 And that's pretty much it. 37 00:02:47,660 --> 00:02:52,450 We would then add in that second provider wrapping the existing one or inside of it. 38 00:02:52,460 --> 00:02:53,350 It really doesn't matter. 39 00:02:53,780 --> 00:03:01,400 So we could put in comments provider like so. 40 00:03:01,590 --> 00:03:02,680 That's pretty much it. 41 00:03:02,700 --> 00:03:04,740 I hope you enjoy putting together this application. 42 00:03:04,740 --> 00:03:09,900 This is definitely a good experience of understanding how to manage application state using context 43 00:03:10,350 --> 00:03:14,400 but this is a pretty simple application and I'm sure you're still curious about how to put together 44 00:03:14,400 --> 00:03:19,800 some more complicated stuff so let's take a quick pause right here and start working on our next application 45 00:03:19,860 --> 00:03:20,640 in the next video.