Now, move in the context of G6 and now we'll be configuring our context.
The G6 and since this is the provider component, that means that it is providing data to all of our
application and it is sitting at a top level.
Therefore, renaming it Konst provider.
All right, so here is that app provider now this is another function.
None of us decide what we want in our state.
So the first piece of state that we want is going to be for are waiting.
That means when we are waiting for a user to select what kind of questions that they want.
And apart from rating will also be needing loading then up as loading, so this is going to hold up
a state when an app is getting loaded into our browsers.
And apart from this, will be needing another state for questions that is going to hold the number of
questions or the area of questions.
And after the questions will also be an index that is going to Parliament next will be needing another
state that is going to help us to count the number of correct questions that we have then.
Apart from it, will also be needing and arrested.
That is going to define how much error have it caused.
Oh, there has been any sorts of error when we were loading an application.
Now, apart from this, the last piece of state that we want is going to be the quiz state.
So now this is going to hold up an object and the state is going to define what users are selected,
for example, whether they want the question numbers to be from one to 10 or they want the questions
to be 20 or 30 or what kind of category of questions that they want.
Apart from it, what is the difficulty level that they have chosen so far?
All this will be using the US state.
OK, so let's import.
I used data from the EC module.
All right, and if you're wondering why and then because you and I have imported react once in application,
well, that's because since the introduction of iOS 16, we are no longer requirement to import react
manually.
It has already been dealt us.
So now let's start using our states.
So for that purpose?
Now, let's create a contest, and this is going to hold up the stage for whether we are waiting or
not, so we're waiting.
And a set of function for this that is going to be called a rating, so said.
Said waiting, which is going to be initially equal to true, that means they're going to assume that
user hasn't entered any sort of data into our application.
So let's just put it up to true now after this waiting, they're going to have another piece of --
that is going to be for loading, whether it has loaded into the browser or not.
So consider loading.
And a set of function for the search loading.
Which is going to be initially false.
So you state.
Well, it's all right, so we have to, which is a state now, now is going to be another state that
is going to be for our questions.
So contest questions.
And a set of function for this that is going to be called a set questions.
And initially, it is going to be an endearing because we haven't gotten any sorts of question into
our application now, so put it up to A..
Now after this are going to create another constant or another function for this that is going to be
for index.
So let's create an index state index and function to set this that is going to be called a set index.
And this is going to have an initial value of zero, so give it your state.
An initial value of zero.
After this, they're going to create another advisory that is going to be for the correct questions
that we have done so correct and set correct.
And this is going to be equal to your state.
And initial values are going to be zero.
So put up zero in this now after this, they're going to deal with the errors if there were any sorts
of errors by loading the question error.
Cetera.
And initially, this is going to be equal to funds.
All right, so here are all the bits of state apart from this, the last piece of -- that we want
to regret is the quiz.
So stress.
And said was.
Now there's a default value that will be giving to our quest, so you state will assume that a user
wants.
All your inserted the field of properties as a default argument that, well, passing up the amount,
we will assume that I use of one 10 questions apart from it will also assume that the category that
a user selected is.
Of sports.
And the difficulty level that they have chosen.
Is easy.
All right, so this is a difficult quiz that we are saving now.
Now let's hit save.
So these are all the pieces of state that we want in our application.
Apart from it will be creating functions so that we can fetch data and where you are.
Let's take a look at our API from where we are getting our data.