And once our buttons are in place now, it's actually add the functionality, and this is the case where
we'll have to add one more action.
Now this will be our last action.
And the name will be change page.
Then in the app context, of course we'll import.
And let's set up the function where in the functional parts, in the page.
So we'll use this function to places we use it where we have the buttons in the button controller.
And you can probably already guess that since each value represents the page, that's the one that will
pass into the function.
And then when it comes to preview next, we'll have to do a little bit of logic before done before we
can pass in that page, but both will use the same thing and then we'll dispatch Change Page.
And as far as the payload will pass in the page, that's coming in as a parameter.
Now we do want to add this one to the value.
So we on export and not the same thing and reducer.
We grab change bench action and then we will look for this type and we'll just set the page in the state
equal to whatever value is passed in and then the variant in the page button, the container, let's
grab the function.
And then for time being again, let's not worry about the premium next, even though those owners will
use it as well.
For now, I just want to go to the buttons in my button container.
I'm then for all of them instead of, look, let's pass in the page number again, which is going to
represent that page in the array.
So let's start, I guess, with the app context or, you know, no actions.
Let's go here.
Let's say that we're looking for change page.
So let me grab this one over here late and then let's write change.
And on the score page, it's service one, none less important in both places right away.
So let's start with the producer, I guess.
We're here, and we'll do the same thing in the context of copy and paste.
Let's go back to the Arab context.
Now get over here.
Copy and paste.
Now let's set up the function.
Now I guess it's going to be all the way down here, by the way, filters.
It's a constant change and and page.
Like I said, it's going to be looking for that particular page.
Value on the dispatch tape will be equal to a change page.
And let's go with payload, which is going to be equal to an object and then will pass in the Page one
service and not in the reducer.
Let's navigate somewhere here and line.
I mean, I don't want to copy and paste.
You know, it's going to be faster if I just go with action.
Type is equal to change page.
And and here simply want to go with return to that state.
I'll let you just set the state page value equal to action payload page.
So Page is equal to action, payload and on page.
Now I did forget something in the app context where I do need to pass this down.
So let's go to our value what's passed in the change page function as well.
And then the last step in the page button container.
So let's navigate over here.
First, let's grab the function change page I believe I'm on.
Let's keep on scrolling.
Like I said, this will be passed in as that page, so that will be displayed here instead of the button.
And also, this is the same thing that will pass in into our change page because we are setting this
as an array and then each item will represent that page.
So let's go where we have the console.log with remove it.
I would just simply say change page and then it's passing the page number.
Let's say that.
And again, we're not going to be triggering anything as far as the request.
We'll do that right after we set up the previous next time being.
I just want to showcase that right now and the state will actually change that value.
So if I find my page somewhere.
Check it out every time or click, I actually will change.
And if you have the same setup now, I can start doing the same thing with preve and next.