So our functionality as far as pagination works really, really well.
But there's a major.
We're actually not triggering any kind of request.
So the only thing that we're doing right now is changing value in the state.
So how it can trigger the request?
Well, let's take a look at the Redmi.
And effectively, we have good jobs, not only I want to get search and arrest all the stuff, but I
also want to get the page because remember when it comes to query params on a server, we actually have
the page now.
We assume that if there is no page, then we just go with page number one.
But of course, we can add that and I'm not going to go to the server and show that.
But if you want to double check, please do so.
So in here, I'll add a query program by the name of Page, which is equal to the page.
So that's going to be the first step.
Next, we want to make sure that every time we change this value, we invoke good jobs from the scratch.
Because just by adding this, I mean, nothing is going to change if we want to trigger a new set of
data that represents that page.
We also need to add here the page to the dependency array, and I'm talking about the jobs container
and the last one.
Probably the most trickiest one is going to be this one where remember, handle change.
So every time we change any of these values, we actually do that using the handle change.
Now what I want to do, every time we change this value, we change the query so automatically.
I'm getting new set of pages, new set up data and therefore I always, always want to set back Page
two number one, because I always want to start with the first page.
Hopefully, I makes sense.
So now let's start working on the good jobs.
So let me navigate right now to my app context, refine my good jobs.
That's going to be the first one.
So that is at a job.
See or hear good jobs.
I get the state value page and I'm just going to add it as a first one.
I mean, you don't have to pardon me because I will.
So let's set it equal to the page, and let's add the percent.
So another query string primer.
Great.
Awesome.
Let's go to the jobs container.
Make sure that we have page here in the import.
And let's add that one right away or here the page.
So let's say it.
And now our pagination works.
So we'll be getting that data.
But like I said, what I want to do is also get page number one.
Now, this isn't the case where I guess I'll show you where the arrow would be.
And by the way, I think it's going to be easier to grasp.
So let me go over here.
And now notice something where as we're changing since we added to dependency array, we're actually
fetching new set up data and we can clearly see that in the network notice our requests.
So the special number one, number two, and hopefully you're see where I'm going with this.
And as we're going to be clicking on these pages, whether that is in a button container or prewar next,
every time we basically get a new set of jobs and now let me showcase the problem if we don't have that
page, set the one.
So at the moment, this is my search.
Now what is my current page?
I believe we're here.
Page number three.
So if let's say I go here with a I'm going to trigger new request would search Hey, but what is the
page rally page rulers number three?
But does that make sense?
I mean, I think it makes way more sense if every time we change this value, we also set the page back
to one.
And if you remember that we also used the here in the ad jump.
But keep in mind, it doesn't really matter whether when we're changing the value in a handle change
in the ad job, whether we set the page to one or not.
That is really irrelevant if you're concerned about that.
So let me go to the producer and then let me find the change.
So handle no change for some reason.
It's going to give me the long road.
So here Hannah will change.
Not only I want to change these rules, but I also always, always want to set back Page two number
one.
So let's say it, and now the functionality is going to work where if I get all of them, OK, awesome.
Everything is going to be beautiful.
But if, let's say I go to page number six and then type something in the form by default, I'll get
the page number one.
And congratulations.
That concludes the pagination functionality.