Hey, hey, I know that we do have a working model and there are some tweaks, and it just means that
you can do to your code and this lesson is going to show you another one that we can do in order to
make it run a little bit more efficiently.
So we've got promises within Futch.
And instead of having data one, we can get out of this and just do a return and pass this over.
So getting that data items map when we return it, it can return that back into the next promise and
then that's where we can handle the show.
So bringing that all in and we've got the return of the items map and then that is returning from the
map.
So I know we've got to return there, but it is important to understand that there's a number of different
ways to present this.
So if we get another promise at the end and then this will be our new array object, and then you can
call that, of course, anything you want, and we can pass this into our show if we want to.
So here, once this has completed, then this promise will go and we can pass in the array data and
there's also an option to catch any errors.
So it's also a good idea to include with any fetch just in case you are throwing errors and you want
to see what the error is so doesn't catch you off guard, you can use a catch and console log at the
air.
So this will only only show if there's any major errors and to the connection.
So otherwise it's not going to show so that we can try that once again and it should do the same thing.
Nothing's changed.
It's the exact same thing, except that we're catching errors and we just restructured the fetch.
So this is another option.
You don't have to include this, but you can include it if you want in order to make your code a little
bit more presentable.
So coming up next, there's also an option of the data that's being returned back where we can get the
next the next page.
So you see in this large object, we've got a next page token and then this is how we can get to the
next page.
So if we do this next page token and add that in.
So if we copy that and we put into the URL and this is fairly long.
So at the end here and we do an end page token and then equal that to whatever the page token value
was, you're going to see that it's going to move to the next page and then always going to have a next
page token.
It's kind of a previous page token.
So you can see that all of these tokens are different and these are representing the different pages.
You can create some page pagination between your content so you can move it to the next page.
I'll show you how to do that coming up.