In the last video we put together our own custom history object inside of our history just file.
So now we can import it into our action create or file and use it to automatically navigate our user
around our application.
So at the top of my action Kreator file I'm going to import history from up one directory history.
So that is my history object that I just created.
Inside that file.
So now to do some programmatic navigation with the user all we have to do is go back down to create
stream I'm going to remove that comment and to programmatically navigate the user around I will call
history dot push Al put the new route that I want the user to navigate to.
So push is how we navigate a user around that's it.
We call it push and we put in a string of the path that we want the user to go to.
In our case flash or our route route it's a list of streams I get.
Let's save this and we'll test it out inside of our browser.
It's going to flip back over.
I'm going to do a quick refresh of the page just for fun.
I'll open up my network request tab just so we can see the stream being created all then go to create
stream form and I'll create a stream or something like I don't know programmatic navigation and I'll
give it a description of you should not see this on the form page because by the time we click submit
the API is going to very quickly create our Stream.
And so we should automatically navigate back over to the stream list whatever the description is bad
but we can deal with it.
OK.
So I got my requests Lague open over here so we're going to see the instant that we see the post requests
go through successfully we will navigate over.
So click on submit and you'll see that the request was completed almost instantaneously and we automatically
got navigated back over to our stream list component.
Awesome.
So that's pretty much it.
That is programmatic navigation.
We're going to do programmatic navigation in a couple of other locations inside of our project for example
after we delete a stream or edit a stream as well.
Now let's take a quick pause right here.
It will continue working on our application in the next video.