Let's implement a load more about Don to get more and sweaty instances from the rest api.
Implementing such an outcome is very easy considering that the ads were released and point also provides
a next parameter so implementing these barfed on is going to be very similar to what we've done here
in the home component.
Yeah I mean the question component and first of all in the data function let's define Nextel as Nola.
And now let's modify the get questions first method accordingly.
So first of all considering that we are going to call this method every time the load mode button is
pressed up let's change the statement.
So yeah we can change it.
Like so these two were not push show spread operator data not results.
Virginia we can basically do the same that we've done here in the home that a few component.
So I'm just going to copy all this code and actually also this other line here like so that D of course
has to be changed to loading that's worse.
And we also need to define it here.
So the answer is equals at the moment.
False.
So back to the method if they did or the next that we set it so that we can then use it as an endpoint
later on
copy
then we can implement a very similar button.
So I'm just going to copy all these Steve
right below deep div container with the answer a component and let's indent back up one and two he's
going to be loading answers
into mantle that we want to call this time is
question answers.
Let's now go back to Chrome right away.
And here we get an error because in fact in data we can't use the equals sign.
We must use color.
So on first.
Sorry about that for now go back to Western to aim at a moment.
Surely we can see that there is no button because the global said things for page no pudgy nation are
the same that we're using of course for the home page.
That's why they're global.
Therefore base size is for.
So let's just set these to two just to test the new batch I'm going to restart the development server
Python server OK.
Let's go back to chrome.
We get three pages here in the on page.
So let's open up.
First question.
India.
We have two answers from rest the test and add me so I'm going to log out and log McKean as random yeah
load more load more and let's add an answer.
Yes sir submitter.
Now let's go back home and let's open up the question again.
And we see that we have debates and even though it's misplaced at the moment but if we click it then
you ask where is added.
Perfect.
Let's actually fix the positioning for the button so in template appear we can just included your inside
of the container.
So
below
like so let's go back once again and let's refresh the page.
Is that a button lot more.
So let's see it's back to the application
you'd have to us then we have Apple question.
So here we have our array of questions.
Also we have Nextel which shows us as you can see the new you add an end point.
So let's click loads more.
Next it goes back to normal.
And the new instance is added to the array.
One last thing that we need to do that you've probably noticed from the beginning is to add these dot
loading answers equals true before using the API set of his function.
I've single page application is getting better and better in the next lesson it will sell to implement
a delete button so that users can delete the ancillary instances they've created if they no longer want
him to be on the platform.