Not bad, not bad.
We have our controlled inputs now, of course, all that much new set of questions once we submit the
form and we're going to start by presenting what we already know why we're doing that.
Of course, we wouldn't want to have a page refresh.
That's number one.
And then the second thing is I would want to construct the euro.
So my goal is following.
I have the root endpoint.
So that's my start.
And then notice this is going to be my eventual euro.
But of course, I would want my you are all to change depending on what values the user set in the input.
So, yeah, this works, but I'm always getting the same set of questions.
So now of course, I would want to somehow, someway construct it myself.
And I'm going to copy and paste this one for now just so we can see what we're working and we'll construct
it ourselves to copy and paste will have temporal.
So at least we know what we're looking for in order to construct it.
Now, I would want to get those values that I'm coming from the state now.
Where are they located?
Of course, in a quiz.
In the quiz, I have the amount and the category and I have the difficulty.
So scroll back down.
And then right after preventing the lethal now I would want to destruction.
So in this case, I'm changing them in the handle change every time user select different option in
input.
Of course, we are changing the virus in the state.
Now, I would want to pull them back out.
And here I'm going to go with cons and we're looking for a mound, we're looking for category and we're
looking for difficulty.
Again, same three properties we have in the object.
And of course, that is coming from my kids, from my state.
And then this is our blueprint.
This is what we would need to construct.
But we would want to set it up dynamically where every time the user changes the value, of course,
it will also affect what we are putting in here.
I'm going to set up a new variable.
I'm going to say const Yoro and I'm going to set it up as a template string.
I definitely need to do that.
And let's start with our endpoint.
So I would want to get this part and where it is multiple here I have the variable by the name of API
endpoint.
Correct.
And notice the string value.
That is exactly what I'm looking for.
So I go here and I'm going to say, all right, get me API endpoint then I don't want to set up my AMOLED.
So what is going to be exactly my amount and of course I do need to set up my you are Uprima like so
modish here and then when it comes to value of course this one will be dynamic, whatever it is, whether
Ariston whether that is 50 or whether that is 12.
So I'll set it equal and now set up dynamically.
I'm correct.
Then we need to do the same thing with difficulty.
But we need this and we're going to go with difficulty.
Make sure that you spoke correctly.
Again, this is the blueprint.
The only thing that is changing is the value because this one I would want to set up dynamically sern
here.
What's the right difficulty?
Of course, that is my state value that I just pulled out.
And also I would want to do the same thing with category now the Gotcher with category Norrish.
When we are constructing DRL, do you see here a sports or there's some kind of no value.
And of course the answer is no value.
And if you want to double check that, just go back to the API and you'll see that when you select the
category sports or politics or whatever actually category has some kind of no value and for some reason
didn't generate anything.
But maybe I didn't notice.
So let me look at history and let's try to generate and there is as you can see, it's not category
equals history.
It is some kind of number of our that is the reason why when I was setting up this application, I didn't
add tons of categories because I left it up to you if you want to them definitely do so.
So what do you need to do is go back to the context just and notice here up on the top, I have the
table and in a table I just set up the object where the categories match the number of values.
So the numbers are what we're passing in the URL and of course, the categories that we have in our
own state.
So instead of just going categories equal to category, which is not going to make sense, we're going
to do a little bit of logic here where.
Yes, because the name of the parameter is the category.
However, it's not going to be equal to the category.
Again, why?
Because it's not a number.
It is some kind of string value.
Instead, again, dynamically, we need to look for a table that is the name of my object.
And then the category again, we're doing the same thing, what we did previously here by accessing
the values dynamically.
So in this case, you'll notice that we're going to get the category we have.
So, for example, if that is sports, as far as the value will get back, this twenty one, hopefully
that is clear.
And the last thing that I would want is this type multiple.
And the reason why I went with type multiple is because later we will set up the answer, the correct
answer dynamically.
So at the moment, we're always placing it at the very end of our answers.
All right.
But of course, I would want to make it a bit more interesting and set it up in various places.
Otherwise, of course, the user can figure out that he or she just needs to click the last button.
But in order to do that, I just need to make sure that I always get type multiple because they also
have true or false questions.
And I wouldn't want them.
I would want to get only typed multiple.
So in here you can just copy and paste or however you'd want to do it.
If you want to, you can retype it as well.
But right after the category.
Just add and and then type multiple, so now of course, we are constructing this Yoro, so our moment
you can keep it for your reference, that is up to you.
And like I said, we won't use the effect to fetch our questions.
Instead, when we submit the form, I would want to watch for the questions.
So we'll scroll down for questions.
And of course, we just need to be in the euro.
So once we do that and of course, I can construct my euro, so I'll change this round, I'll say,
you know, give me five questions.
The category should be history.
And as far as difficulty, I don't know.
I'm going to go with the medium.
We start amateurs.
Now, if those questions and I already know that the correct answer is at the very end.
And here I can see that I have one correct answer.
And I have answered so far one question and of course, I'll cheat a little bit where I'm going to get
four questions correctly.
And then the last one all my up and I'll say Russian.
And there is now of course I have congrats.
You answered 80 percent of questions correctly and here I have play again.
So we start the game again.
And when it comes to error, let's try it out.
I'm not going to go with fifty questions.
And as far as the category, I think I'm going to stick with politics and maybe hard because I believe
that was the option where API wasn't able to provide those questions.
We clicked start and I notice we're loading for a second and then our display can generate questions.
Please try different options.
Now we're almost done with our application.
But in the next video, I would want to make it a bit more interesting where I placed this correct answer
in various places, depending on the question, instead of always placing it at the very end.