Narrator: In the last section,
we put together our signout action creator.
Now, in that section,
I had said that to remove a piece of information
from local state, we called clearItem,
that was a mistake on my behalf.
I meant to say that it was removeItem.
That's the name of the method.
So if we call removeItem
and we pass in the key that we want to delete,
poof, it'll just be deleted from our local storage.
So again, removeItem, not clearItem.
Now that we have this action creator all put together,
we're gonna go back over to our signout component
and we'll wire that action creator up to this component.
So at the top, I'm going to import the connect helper
from react-redux and I will import star as actions
from up two directories actions folder.
Then down at the bottom, we'll set up our connect helper.
We don't have any map state to props function here.
So as a first argument, I'll pass in null.
And then as a second argument,
I'll pass in all of my actions.
And I'll make sure I get my second set of parentheses
around the signout method,
or excuse me, a signout component as well.
Now inside the signout component itself,
we can define a lifecycle method of componentDidMount.
So the instant this component appears on the screen,
we're gonna call the this.props.signout action creator
and that's going to attempt to sign our user
out of our application entirely
both by removing the authenticated JSON web token
out of our reducer
and by clearing the local storage token key.
So now we can test this out
by going back over to our browser.
I'm already signed out of our application.
So if I try to go to feature,
it redirects me to the root route.
So I'll first get started by signing up for a new account
which will sign me in to the application.
Okay, so I'm now signed in.
And if I click on signout,
I get kicked back to the signout route.
And if I now try to go to feature,
it redirects me back to the root route of the application
'cause I am not signed in.
All right, so I think signout is working perfectly.
Let's continue to the next section
where I think all we have to do now
is start working on our signin form.
So quick break and I'll see you in just a minute.