1 00:00:01,370 --> 00:00:06,680 In the last video we put together our own custom history object inside of our history just file. 2 00:00:06,710 --> 00:00:11,730 So now we can import it into our action create or file and use it to automatically navigate our user 3 00:00:11,760 --> 00:00:13,530 around our application. 4 00:00:13,530 --> 00:00:20,840 So at the top of my action Kreator file I'm going to import history from up one directory history. 5 00:00:20,910 --> 00:00:23,340 So that is my history object that I just created. 6 00:00:23,340 --> 00:00:24,740 Inside that file. 7 00:00:24,780 --> 00:00:30,300 So now to do some programmatic navigation with the user all we have to do is go back down to create 8 00:00:30,300 --> 00:00:36,690 stream I'm going to remove that comment and to programmatically navigate the user around I will call 9 00:00:36,750 --> 00:00:42,180 history dot push Al put the new route that I want the user to navigate to. 10 00:00:42,180 --> 00:00:45,400 So push is how we navigate a user around that's it. 11 00:00:45,510 --> 00:00:50,280 We call it push and we put in a string of the path that we want the user to go to. 12 00:00:50,400 --> 00:00:54,850 In our case flash or our route route it's a list of streams I get. 13 00:00:54,870 --> 00:00:57,820 Let's save this and we'll test it out inside of our browser. 14 00:00:59,140 --> 00:01:00,350 It's going to flip back over. 15 00:01:00,400 --> 00:01:03,600 I'm going to do a quick refresh of the page just for fun. 16 00:01:03,680 --> 00:01:09,830 I'll open up my network request tab just so we can see the stream being created all then go to create 17 00:01:09,830 --> 00:01:16,340 stream form and I'll create a stream or something like I don't know programmatic navigation and I'll 18 00:01:16,340 --> 00:01:26,000 give it a description of you should not see this on the form page because by the time we click submit 19 00:01:26,390 --> 00:01:28,710 the API is going to very quickly create our Stream. 20 00:01:28,730 --> 00:01:33,850 And so we should automatically navigate back over to the stream list whatever the description is bad 21 00:01:33,860 --> 00:01:34,950 but we can deal with it. 22 00:01:35,130 --> 00:01:35,380 OK. 23 00:01:35,390 --> 00:01:40,430 So I got my requests Lague open over here so we're going to see the instant that we see the post requests 24 00:01:40,430 --> 00:01:43,030 go through successfully we will navigate over. 25 00:01:43,160 --> 00:01:49,190 So click on submit and you'll see that the request was completed almost instantaneously and we automatically 26 00:01:49,190 --> 00:01:53,160 got navigated back over to our stream list component. 27 00:01:53,210 --> 00:01:54,210 Awesome. 28 00:01:54,260 --> 00:01:55,060 So that's pretty much it. 29 00:01:55,070 --> 00:01:56,900 That is programmatic navigation. 30 00:01:56,990 --> 00:02:02,720 We're going to do programmatic navigation in a couple of other locations inside of our project for example 31 00:02:02,720 --> 00:02:05,680 after we delete a stream or edit a stream as well. 32 00:02:05,950 --> 00:02:07,400 Now let's take a quick pause right here. 33 00:02:07,400 --> 00:02:10,260 It will continue working on our application in the next video.