Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:01,130 --> 00:00:06,410
In this section cleanup we're going to do something that you may or may not have noticed that we have
2
00:00:06,410 --> 00:00:13,180
left out so far and that's actually going in wire up all of our buttons on the home page all the learn
3
00:00:13,190 --> 00:00:15,630
more buttons the estimate buttons.
4
00:00:15,740 --> 00:00:19,180
None of them are actually taking us to any of the pages.
5
00:00:19,190 --> 00:00:24,350
So in this video I'm going to try and as quickly as I can we're gonna go through and set up all those
6
00:00:24,350 --> 00:00:27,770
buttons and fix a tiny little bug that showed up as well.
7
00:00:27,770 --> 00:00:32,200
So let's go over to the code editor and take care of all that.
8
00:00:32,270 --> 00:00:33,020
Here we are.
9
00:00:33,020 --> 00:00:35,980
And let's start getting these buttons hooked up.
10
00:00:36,050 --> 00:00:41,210
So if you realize we even the button in the header we even forgot to hook that one up.
11
00:00:41,210 --> 00:00:48,410
So let's go in and we'll start with that in our header dot J.S. file and we'll come all the way down
12
00:00:48,770 --> 00:00:52,650
to where we have our estimate button.
13
00:00:52,670 --> 00:00:56,460
See there's a draw here is tabs.
14
00:00:56,570 --> 00:01:04,190
And here is our free estimate button and we need to go ahead and we'll add the component property here
15
00:01:04,820 --> 00:01:08,950
and feed it the link that we've imported from react router.
16
00:01:08,990 --> 00:01:16,160
And of course that means we'll need our two property telling it to go to our slash estimates route so
17
00:01:16,160 --> 00:01:19,280
we can save this page or refresh.
18
00:01:19,310 --> 00:01:25,100
And now if we go up to our header button and we click that we're navigated over to the estimate route
19
00:01:25,460 --> 00:01:28,190
with the estimate content on the screen.
20
00:01:28,190 --> 00:01:31,610
But we have the Home tab marked as active.
21
00:01:31,610 --> 00:01:39,380
So what I want to do when we navigate to our estimate route I want to actually clear off any active
22
00:01:39,380 --> 00:01:46,390
tab and you can do that by calling the set value function and passing in an index.
23
00:01:46,430 --> 00:01:50,100
They actually does not appear within your tabs.
24
00:01:50,150 --> 00:01:58,850
So since we have 0 0 1 2 3 and 4 if we pass in an index of five that's actually going to clear the active
25
00:01:58,850 --> 00:01:59,460
tab.
26
00:01:59,600 --> 00:02:02,720
And that's kind of what I want for the estimate page.
27
00:02:02,720 --> 00:02:08,880
So similar to how these menu items have to call the set value from props.
28
00:02:09,080 --> 00:02:19,700
We want our estimate button to on click also call our props to set value and passing five but we don't
29
00:02:19,700 --> 00:02:26,590
want this to fire right away so make sure to put in the parentheses and make this an arrow function.
30
00:02:26,690 --> 00:02:29,520
So that will be called at the correct time.
31
00:02:29,540 --> 00:02:36,860
So let's save this now and we will navigate let's go back to the home page and let's go back to the
32
00:02:36,860 --> 00:02:39,980
estimate page with our estimate button in the header.
33
00:02:40,100 --> 00:02:47,350
We click that we're navigated over and you see the Home tab is no longer marked as active one thing
34
00:02:47,350 --> 00:02:54,610
to note however is if we refresh the page the Home tab is actually being marked as active again.
35
00:02:54,700 --> 00:03:01,630
And if we come up to our use affect function here in the header where we are implementing our refresh
36
00:03:01,690 --> 00:03:08,950
fix we're actually doing this based on the menu options and our roots objects up here and neither of
37
00:03:08,950 --> 00:03:12,120
these include our estimate route.
38
00:03:12,220 --> 00:03:17,320
And so what we need to do is we need to come down and add a case.
39
00:03:17,320 --> 00:03:18,880
So make sure see up.
40
00:03:18,880 --> 00:03:27,760
So underneath our break is statement here add another case and if we are on the slash estimate route
41
00:03:28,150 --> 00:03:34,870
well then we need it to props set value of five.
42
00:03:34,870 --> 00:03:42,550
We can go ahead and break out of that afterwards and if we save this now the page will refresh and the
43
00:03:42,550 --> 00:03:45,550
Home tab is now no longer selected.
44
00:03:45,550 --> 00:03:47,330
So we can go back to the home.
45
00:03:47,380 --> 00:03:49,110
Let's go back to free estimate.
46
00:03:49,120 --> 00:03:50,490
It's no longer selected.
47
00:03:50,560 --> 00:03:54,430
We can refresh the page and it still is not selected.
48
00:03:54,430 --> 00:03:56,680
So I'm glad we're able to take care of that real quick.
49
00:03:56,910 --> 00:03:59,240
We can now go back to our home page.
50
00:03:59,320 --> 00:04:04,250
We can close out of the header and let's start hooking up the rest of the buttons.
51
00:04:04,330 --> 00:04:13,450
So in our landing page component let's make sure we need to actually come up and let's import our link
52
00:04:13,930 --> 00:04:17,500
from react router Dom.
53
00:04:17,560 --> 00:04:21,100
And now we can go to all of our items.
54
00:04:21,100 --> 00:04:25,960
So we'll start with the estimate button here in the hero block.
55
00:04:26,020 --> 00:04:37,840
We'll add the component equals link and then a two equal to slash estimate and let's go ahead and copy
56
00:04:37,840 --> 00:04:41,930
the component and two props because we're gonna be repeating this a lot.
57
00:04:41,980 --> 00:04:48,550
And now let's go in and we'll add that to the learn button but this learn button I actually want to
58
00:04:48,550 --> 00:04:51,100
take us to slash revolution.
59
00:04:51,100 --> 00:04:53,320
So that's where I want that one to go to.
60
00:04:53,470 --> 00:05:00,430
And now we can keep coming down and our button here for the and learn more button on the custom software
61
00:05:00,430 --> 00:05:09,780
development that is going to take us to slash custom software of course and scrolling down.
62
00:05:09,780 --> 00:05:15,160
We now have the button for the IOW Android app development.
63
00:05:15,210 --> 00:05:24,390
We will paste our props give that a slash mobile apps route and then here is our button for Web site
64
00:05:24,390 --> 00:05:25,740
development.
65
00:05:25,740 --> 00:05:30,180
We'll give it a slash Web sites keep coming down.
66
00:05:30,180 --> 00:05:32,950
You have the button in the revolution block.
67
00:05:33,000 --> 00:05:35,150
Here's that button right there.
68
00:05:35,160 --> 00:05:40,660
Paste those in and this is also going to slash revolution.
69
00:05:40,700 --> 00:05:42,580
Keep scrolling down.
70
00:05:42,590 --> 00:05:45,960
Now we're going to have the about us info blog.
71
00:05:46,040 --> 00:05:55,070
So on this button paste into slash about and then the contact us learn more button right here.
72
00:05:55,070 --> 00:06:03,610
Paste that to slash contact the final button we have to hook up is the estimate button here in our call
73
00:06:03,610 --> 00:06:04,770
to action.
74
00:06:04,870 --> 00:06:10,200
So let's go over and open up the call to action dot J S.
75
00:06:10,210 --> 00:06:22,740
And here we also need to come up and import our link from react ruder Dom if I can get that right.
76
00:06:22,930 --> 00:06:25,870
And then we'll come back down to our button.
77
00:06:25,930 --> 00:06:29,680
We'll paste those in and give it a slash estimate.
78
00:06:29,710 --> 00:06:30,700
It's actually already right.
79
00:06:31,180 --> 00:06:36,870
So we can go ahead and save this now and come back and we can save our landing page.
80
00:06:36,870 --> 00:06:42,730
And so all refresh and all of these buttons should now be working on the estimate page.
81
00:06:42,730 --> 00:06:47,400
I think that that actually you know it looks like we got that one more button.
82
00:06:47,440 --> 00:06:48,550
We didn't change that.
83
00:06:48,850 --> 00:06:56,630
So over on the call to action up we put the estimate on the learn more button.
84
00:06:56,630 --> 00:07:02,650
We need to put that to slash revolution and then we didn't even get it on the button here.
85
00:07:02,660 --> 00:07:03,740
I don't know what I was thinking.
86
00:07:03,770 --> 00:07:04,820
Slash estimate.
87
00:07:04,820 --> 00:07:05,870
There we go.
88
00:07:05,870 --> 00:07:07,040
So we save that.
89
00:07:07,190 --> 00:07:10,790
And now more and more takes us over to the revolution.
90
00:07:10,880 --> 00:07:12,050
Go home.
91
00:07:12,050 --> 00:07:13,460
We can try any of these buttons.
92
00:07:13,470 --> 00:07:13,790
Now
93
00:07:21,520 --> 00:07:27,150
you see all of these are now properly navigating us to the correct pages.
94
00:07:27,160 --> 00:07:34,630
The only thing is it is still not updating our active tab because we haven't set up any of these links
95
00:07:34,810 --> 00:07:36,540
to do that for us either.
96
00:07:36,580 --> 00:07:44,050
So we need to come to our app dot J.S. file and in the same way that we passing in value and set value
97
00:07:44,290 --> 00:07:50,350
and selected index and set selected index to our header and footer we need to pass that to our landing
98
00:07:50,350 --> 00:07:51,370
page as well.
99
00:07:52,000 --> 00:07:58,710
And I realized actually there with our footer we're never using value or selected index.
100
00:07:58,720 --> 00:08:03,780
We're actually just using the functions to change those values.
101
00:08:03,840 --> 00:08:05,900
Set value and set selected index.
102
00:08:06,010 --> 00:08:10,330
And that's actually all we're going to need for the remaining page as well.
103
00:08:10,330 --> 00:08:14,220
So we'll come up and we're we're passing in our landing page component.
104
00:08:14,260 --> 00:08:23,770
Let's change this to now be an actual landing page component like this and we will add the props set.
105
00:08:23,770 --> 00:08:35,070
Value equals the set value function and the set selected index is equal to our set selected index function.
106
00:08:35,230 --> 00:08:40,200
So we can go ahead and save our app dot J.S. file page will refresh.
107
00:08:40,200 --> 00:08:45,360
We can come back to our home screen and here you see that we have an error.
108
00:08:45,370 --> 00:08:48,210
The landing page is not rendering correctly.
109
00:08:48,310 --> 00:08:55,450
And I wanted to show you this because you can't actually add props to a component in a react router
110
00:08:55,480 --> 00:08:57,120
route like this.
111
00:08:57,130 --> 00:09:01,480
So what we need to do instead is they have a different problem.
112
00:09:01,540 --> 00:09:09,430
So instead of component what's changed that to render and here we're going to create an arrow function
113
00:09:09,880 --> 00:09:14,020
with props as input and we'll open that up.
114
00:09:14,440 --> 00:09:22,120
And here we can set our component with its props like this but we also need to make sure to extend all
115
00:09:22,120 --> 00:09:23,770
of the other props.
116
00:09:23,830 --> 00:09:31,240
So make sure that you have that and if we save we'll see the page refresh and our landing page reappears.
11774
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.