1 00:00:01,730 --> 00:00:06,410 Custom hooks are a great way to wrap up reusable logic inside of reactor application, so there are 2 00:00:06,410 --> 00:00:10,460 going to be many times where you have to use hooks that have been put together by other engineers. 3 00:00:10,760 --> 00:00:14,960 And in some cases, there might not be a lot of documentation around how these hooks work. 4 00:00:15,320 --> 00:00:18,980 So sometimes you're just going to have to read the source code and understand what they are doing for 5 00:00:18,980 --> 00:00:19,170 you. 6 00:00:19,760 --> 00:00:24,380 So this is going to be a quick exercise to kind of walk you through that entire process. 7 00:00:25,040 --> 00:00:31,250 In this little application, we've got to files the aptness file and use Postgres file. 8 00:00:31,760 --> 00:00:33,680 Use post is a custom hook. 9 00:00:33,680 --> 00:00:37,900 It is going to reach out to some API and fetch a list of posts and then somehow return them. 10 00:00:38,630 --> 00:00:44,120 So it's up to you to somehow import that hook into the aptness file and then make use of it inside the 11 00:00:44,120 --> 00:00:44,870 app component. 12 00:00:45,350 --> 00:00:49,670 Our ultimate goal here is to get some kind of host variable inside the app component. 13 00:00:50,150 --> 00:00:55,610 You'll notice that on line six right now, we are trying to access a post variable and it's very clear 14 00:00:55,610 --> 00:00:57,590 that we kind of expect it to be an array. 15 00:00:57,840 --> 00:00:59,840 But right now, post is just not defined. 16 00:00:59,840 --> 00:01:03,100 And so we are probably ending up with an error as it stands right now. 17 00:01:04,020 --> 00:01:08,640 So go ahead, import the hook, try to use it inside the component and get a list of polls to show up 18 00:01:08,640 --> 00:01:13,130 on the screen, go ahead and give this a shot and we'll go over solution in just a moment.