1
00:00:00,240 --> 00:00:06,430
So now that we need a piece of state to hold our data, so for that purpose, maybe be just using the

2
00:00:06,430 --> 00:00:08,520
use data, which he has started about.

3
00:00:08,820 --> 00:00:15,240
So let's just import I use data from a React module and create a concert.

4
00:00:18,050 --> 00:00:20,480
Those and a set of function set tools.

5
00:00:23,670 --> 00:00:26,100
And we will be having the initial state value as.

6
00:00:28,470 --> 00:00:33,660
And issue of state value as an empty area, because initially we don't want any data, not right.

7
00:00:33,900 --> 00:00:37,710
And the next step is to create a function that is going to facilitate API.

8
00:00:38,310 --> 00:00:46,350
And so let's create a function with guns to get user is going to be able the function and due to the

9
00:00:46,350 --> 00:00:49,470
condition that doesn't already do us, we need this function to be an agent function.

10
00:00:49,470 --> 00:00:56,820
So that raises the weights when we put up an object, you are in front of an API call to so that it

11
00:00:56,820 --> 00:00:57,810
can resolve a promise.

12
00:00:58,140 --> 00:01:05,610
What I'm talking about just said now let's create a concept for that first try, catch, block and catch

13
00:01:06,660 --> 00:01:14,400
if any error occurs, which it shouldn't, hopefully just console blogger added.

14
00:01:16,280 --> 00:01:22,850
OK, in attack in a trademark, let's just go and a response which is going to be a promise from our

15
00:01:24,830 --> 00:01:25,550
search method.

16
00:01:28,080 --> 00:01:29,610
And the API call is.

17
00:01:32,230 --> 00:01:36,790
S GDP scores API dot com reactors project.

18
00:01:37,270 --> 00:01:43,000
And this is going to return a promise, and let's just put up and await key word right in front of us.

19
00:01:43,570 --> 00:01:44,500
But matter.

20
00:01:45,830 --> 00:01:49,960
No, it is going to give us a promise right now.

21
00:01:49,960 --> 00:01:53,950
Let's create the concert dose, which should be equal to.

22
00:01:54,250 --> 00:01:56,740
And then we will again be putting up a great keyboard.

23
00:01:57,940 --> 00:02:00,010
And there should be a response.

24
00:02:00,420 --> 00:02:01,210
Dr. Jason.

25
00:02:01,210 --> 00:02:05,650
So what we need is to convert the theater into adjacent formats so that we can actually use that data

26
00:02:05,650 --> 00:02:09,160
because unless and until it's in JASON format, it's of no use to us.

27
00:02:11,080 --> 00:02:16,260
No, that's just said to function and provide tools.

28
00:02:17,320 --> 00:02:17,950
Okay.

29
00:02:17,950 --> 00:02:20,800
So we have successfully implemented a try catch block.

30
00:02:21,430 --> 00:02:26,680
Now we need to call this function and the best place might be the use effect, right?

31
00:02:28,050 --> 00:02:30,390
So let's just call it nine years if I took.

32
00:02:31,440 --> 00:02:33,240
OK, use, eat or whatever.

33
00:02:33,750 --> 00:02:34,100
Right?

34
00:02:35,250 --> 00:02:39,110
And of course, mine between no use.

35
00:02:39,180 --> 00:02:39,720
Effect.

36
00:02:43,550 --> 00:02:50,960
And and say the use effect is another callback function, which you're just going to get use of.

37
00:02:52,580 --> 00:02:58,760
Now you might remember that there's a second argument which we can pass, which can be a specific argument

38
00:02:58,760 --> 00:03:04,110
that we want the company to render only when that company, only when the business changes.

39
00:03:04,110 --> 00:03:07,370
But for this particular project, we'll just pass it in theory.

40
00:03:07,790 --> 00:03:11,290
So you know what happens when you pass an empty area whenever he was an entity?

41
00:03:12,110 --> 00:03:17,510
This function is going to be called only once, and that is when the component is going to mount.

42
00:03:18,230 --> 00:03:24,200
So in hit safe and we have successfully added dynamics or API to our app.

43
00:03:24,800 --> 00:03:26,000
So let's move forward.
