1
00:00:01,830 --> 00:00:05,610
Now, move in the context of G6 and now we'll be configuring our context.

2
00:00:06,000 --> 00:00:13,080
The G6 and since this is the provider component, that means that it is providing data to all of our

3
00:00:13,080 --> 00:00:15,420
application and it is sitting at a top level.

4
00:00:15,750 --> 00:00:18,150
Therefore, renaming it Konst provider.

5
00:00:24,260 --> 00:00:27,320
All right, so here is that app provider now this is another function.

6
00:00:30,160 --> 00:00:33,220
None of us decide what we want in our state.

7
00:00:34,240 --> 00:00:38,500
So the first piece of state that we want is going to be for are waiting.

8
00:00:38,890 --> 00:00:44,920
That means when we are waiting for a user to select what kind of questions that they want.

9
00:00:45,950 --> 00:00:51,670
And apart from rating will also be needing loading then up as loading, so this is going to hold up

10
00:00:51,670 --> 00:00:55,760
a state when an app is getting loaded into our browsers.

11
00:00:57,050 --> 00:01:02,420
And apart from this, will be needing another state for questions that is going to hold the number of

12
00:01:02,420 --> 00:01:04,070
questions or the area of questions.

13
00:01:04,820 --> 00:01:11,330
And after the questions will also be an index that is going to Parliament next will be needing another

14
00:01:11,330 --> 00:01:15,290
state that is going to help us to count the number of correct questions that we have then.

15
00:01:16,070 --> 00:01:19,280
Apart from it, will also be needing and arrested.

16
00:01:19,280 --> 00:01:21,710
That is going to define how much error have it caused.

17
00:01:22,670 --> 00:01:26,390
Oh, there has been any sorts of error when we were loading an application.

18
00:01:26,810 --> 00:01:31,190
Now, apart from this, the last piece of state that we want is going to be the quiz state.

19
00:01:31,550 --> 00:01:38,000
So now this is going to hold up an object and the state is going to define what users are selected,

20
00:01:38,000 --> 00:01:43,520
for example, whether they want the question numbers to be from one to 10 or they want the questions

21
00:01:43,520 --> 00:01:48,410
to be 20 or 30 or what kind of category of questions that they want.

22
00:01:48,740 --> 00:01:52,400
Apart from it, what is the difficulty level that they have chosen so far?

23
00:01:52,400 --> 00:01:54,350
All this will be using the US state.

24
00:01:54,350 --> 00:01:55,490
OK, so let's import.

25
00:01:55,490 --> 00:01:57,920
I used data from the EC module.

26
00:02:04,240 --> 00:02:09,910
All right, and if you're wondering why and then because you and I have imported react once in application,

27
00:02:09,910 --> 00:02:15,340
well, that's because since the introduction of iOS 16, we are no longer requirement to import react

28
00:02:15,340 --> 00:02:15,820
manually.

29
00:02:15,820 --> 00:02:16,960
It has already been dealt us.

30
00:02:17,590 --> 00:02:20,200
So now let's start using our states.

31
00:02:20,470 --> 00:02:21,520
So for that purpose?

32
00:02:24,350 --> 00:02:28,460
Now, let's create a contest, and this is going to hold up the stage for whether we are waiting or

33
00:02:28,460 --> 00:02:30,140
not, so we're waiting.

34
00:02:33,930 --> 00:02:37,590
And a set of function for this that is going to be called a rating, so said.

35
00:02:41,750 --> 00:02:48,220
Said waiting, which is going to be initially equal to true, that means they're going to assume that

36
00:02:48,280 --> 00:02:51,800
user hasn't entered any sort of data into our application.

37
00:02:51,800 --> 00:02:56,750
So let's just put it up to true now after this waiting, they're going to have another piece of --

38
00:02:56,760 --> 00:03:00,230
that is going to be for loading, whether it has loaded into the browser or not.

39
00:03:00,680 --> 00:03:01,970
So consider loading.

40
00:03:03,610 --> 00:03:05,860
And a set of function for the search loading.

41
00:03:09,370 --> 00:03:11,110
Which is going to be initially false.

42
00:03:14,040 --> 00:03:14,880
So you state.

43
00:03:15,840 --> 00:03:21,180
Well, it's all right, so we have to, which is a state now, now is going to be another state that

44
00:03:21,180 --> 00:03:22,410
is going to be for our questions.

45
00:03:23,220 --> 00:03:24,990
So contest questions.

46
00:03:26,790 --> 00:03:29,940
And a set of function for this that is going to be called a set questions.

47
00:03:34,630 --> 00:03:39,370
And initially, it is going to be an endearing because we haven't gotten any sorts of question into

48
00:03:39,370 --> 00:03:42,250
our application now, so put it up to A..

49
00:03:42,530 --> 00:03:48,790
Now after this are going to create another constant or another function for this that is going to be

50
00:03:48,790 --> 00:03:49,660
for index.

51
00:03:49,660 --> 00:03:57,370
So let's create an index state index and function to set this that is going to be called a set index.

52
00:03:59,400 --> 00:04:04,230
And this is going to have an initial value of zero, so give it your state.

53
00:04:09,740 --> 00:04:11,150
An initial value of zero.

54
00:04:12,970 --> 00:04:16,660
After this, they're going to create another advisory that is going to be for the correct questions

55
00:04:16,660 --> 00:04:21,100
that we have done so correct and set correct.

56
00:04:23,090 --> 00:04:26,090
And this is going to be equal to your state.

57
00:04:29,990 --> 00:04:32,030
And initial values are going to be zero.

58
00:04:32,600 --> 00:04:37,820
So put up zero in this now after this, they're going to deal with the errors if there were any sorts

59
00:04:37,820 --> 00:04:40,730
of errors by loading the question error.

60
00:04:43,350 --> 00:04:44,020
Cetera.

61
00:04:46,460 --> 00:04:49,070
And initially, this is going to be equal to funds.

62
00:04:54,880 --> 00:04:59,230
All right, so here are all the bits of state apart from this, the last piece of -- that we want

63
00:04:59,270 --> 00:05:00,220
to regret is the quiz.

64
00:05:00,910 --> 00:05:02,110
So stress.

65
00:05:03,560 --> 00:05:04,820
And said was.

66
00:05:06,070 --> 00:05:11,890
Now there's a default value that will be giving to our quest, so you state will assume that a user

67
00:05:11,890 --> 00:05:12,400
wants.

68
00:05:14,730 --> 00:05:20,520
All your inserted the field of properties as a default argument that, well, passing up the amount,

69
00:05:21,450 --> 00:05:28,410
we will assume that I use of one 10 questions apart from it will also assume that the category that

70
00:05:28,410 --> 00:05:29,670
a user selected is.

71
00:05:31,950 --> 00:05:32,960
Of sports.

72
00:05:36,680 --> 00:05:38,810
And the difficulty level that they have chosen.

73
00:05:43,920 --> 00:05:44,700
Is easy.

74
00:05:47,930 --> 00:05:51,740
All right, so this is a difficult quiz that we are saving now.

75
00:05:52,610 --> 00:05:53,900
Now let's hit save.

76
00:05:54,620 --> 00:05:57,500
So these are all the pieces of state that we want in our application.

77
00:05:57,680 --> 00:06:02,690
Apart from it will be creating functions so that we can fetch data and where you are.

78
00:06:02,870 --> 00:06:05,870
Let's take a look at our API from where we are getting our data.
