Amazing job, and I think we can set up functionality where once we click on remove button, I would
want to remove this particular story from my UI.
Please keep in mind that, of course, just because we removed this particular story from the UI doesn't
mean that we remove it from the whole API, just means that we are not displaying it on a screen.
When I fetch a new page, of course.
Again, I get all the stories and the way we'll set this up, we're going to navigate through context.
Yes.
And first thing I would want to set up is my function.
So I'm going to go here with CONSED and we just need to come up with a name.
My guess is going to be remove and then story.
Now keep in mind that is not the variable.
The variable, of course we use later when we do this projection for the time being, I'm just going
to say remove story and I'm going to be looking for Heidi.
So from the button.
I'll pass in the alley and then, of course, I'll do something with that idea in my dispatch for the
time being, will just cancel Lagarde and then I have my function.
I just need to pass it down.
So in the value, let's say, remove story.
And since I would want to use it in my story, I'm going to navigate stories I'm looking for remove,
remove and then story function.
And then once I click on a button, the remote button, which I would want to invoke to function from
here, let's go with unclick is equal and we're going to go with remove story.
Now, the gotcher here is that of course, I need to go with my error function because I would only
want to invoke it once I click on a button.
So remove story and then I would want to pass in my I.D..
Now what is my idea?
Because that is the object, Kirk, since that was the property.
So of course, if you want.
You can give it some kind of alias, but I think in my case, I'm just going to stick with this particular
property, the object here, remove story and let's pass an object and will navigate the bigger screen
just so I have a clearer view.
And if I take a look at the console, I should see every time some kind of idea once I click on remove
button.
That's awesome, because now I have that idea.
I just need to set up the functionality.
So I'm going to have to get back to the context.
Yes, my initial structure is in place.
So now of course, let's dispatch an action.
So let's say dispatch and we'll pass in again.
The object type is remove story.
That's my variable name.
And then as far as the payload, well, I'll pass in the same idea.
So payload is equal to my idea.
I'll save it.
And then the last step is just navigating to reduce address.
And of course, we would want to handle it in here as well.
Let's keep on scrolling without such stories.
And then we have defo so in between we're going to go with case and then what is the case?
Well, that is removed story.
Correct.
And then as far as the functionality, again, the same thing that are not so spread out all the values
in the state.
And then as far as the head.
All right, away, do the functionality where I'm going to set new value for my hits.
All right.
How it is going to be equal to state hits and then filter.
So I want to filter out my current hits again.
Keep in mind, in some cases, we're doing the functionality above the return where I was setting up
explicit variables.
In this case.
I'm just doing it where I'm spreading out the object and then I'm setting the new value for it.
That is really a preference.
So I'm going to go with a filter here and then I'm going to look for my story.
And then if the story object ID doesn't match my payload beautiful, that story will be returned.
If the ID does match, then of course I would want to remove it.
And again, the reason why we're doing this somewhat fast, because we have done that already quite
a few times in our course.
So we're going to go with a story.
And then the gotcha here is that, of course, the property name is Object ID.
So don't set this up, Heidi, because it's not going to work.
We go with object and then uppercase ID and if the ID doesn't match my payload, only then return that
story.
So action and then going to navigate the bigger screen and then notice how nicely can remove stories
from the UI.