None of us feared the method that is going to feature a diplomat API, so right beneath her, Constance
will be creating a matter that is going to fetch your questions.
So let's create a method.
So this is the name of the matter that recreating now, since we are using an API call in this, that
means we need to get data.
Therefore, we are in agreement to use the keyword which we like to use the async when async functions.
So this is going to be an async function.
Now, let's importer Axios, because we'll be needing it.
So if I just head up, so it has already been important for me.
So all you have to do is just that we'll have to import.
Axios from Axios.
So it's done now.
Now, what I want to do is that will be creating a constant so let's create a concert and the name of
this constant is going to be a response.
So this constant is going to be the response that is going to be equal to await.
Because we want to tell that, hey, wait for this promise to resolve when we're done getting our data,
then you can move forward.
So now they will be pasting our data that we got from our API.
So this is the temporary.
API call that you're making now, if some sort of error occurs, then for that will be creating a catch
statement.
And if anything's full back then, just report an error.
And all I want you to do is that is just going to allow this zero.
All right, so this is that API call now after this, what I need to do is that will be creating a submit
button that is going to be passed to a set up form.
But before we do that, let me just not going to set up a different states.
So right after our response, if our response has been true, if we have got some data, then is checking
that if the response is true and if it is true, then what I want is that they will be creating contact
data, which is going to be equal to this point.
Stored data.
The results.
All right, so this is the data that we're getting from our results, I mean response now after this,
if this is after this happens, they will be declaring a statement.
And if Detroit or Flint, that means if we have some data inside our data content.
Then what they want to do is that then they want to settle questions, then.
Set questions.
Because of the data that we have gotten, so will be setting up our questions, which initially is an
empty area, but once we have gotten, our data will be setting up of questions now after we have settled
about questions, what it is that will make sure that our loading as well as that we are, that means
we have gotten our data from Arabia so that loading the files as well as circulating two files.
And as I said, noting and said, reading will also be setting Ed Balls because there was no arrow inside
application, so said error two equals so false.
All right.
So we have these three pieces of state and as if this happens, then we want to do this.
And if they don't learn to zero, that means if I did not, load length is not true, then what do you
want to do?
Then we want to set.
Then we want to.
Make sure that are circulating.
Is true as well, as I said, learning is true.
Alright, so if I did not land is true, then we want to set questions to that data.
We want to start loading the files, we want to get ready to file, we want to set ED.
And if I returning to zero, then we want to rating to do as well as set out loading to true.
Now, if our response is false, now this and this, if it actually nested under this particular, if
this parent know if a parent is false, then what do you want to do then?
And what are they going to put up?
Is that said waiting to throw?
All right, now, apart from this and the starting of a function right beneath right above our country
response, they make sure there are certain loading.
It's true because we haven't actually faced any sort of detail apart from that loading, we'll also
be putting set waiting to false.
So sit waiting.
True, false, because at this point of time, we are waiting for our data to be finished, but our
application is ready.
All right, so we have set it up a function.
Now we need to call this function and four which will be creating another method insider context logistics.