1
00:00:00,930 --> 00:00:03,270
All right, let's take care of a little bit of code cleanup.

2
00:00:03,540 --> 00:00:08,460
This is mostly just removing some unused variables, solving a couple of warnings and maybe also moving

3
00:00:08,460 --> 00:00:12,130
around a couple of different files to get a little bit better project structure.

4
00:00:12,570 --> 00:00:17,640
So first, inside our indexed TSX file, we're no longer making use of fact or USRAP inside here.

5
00:00:18,000 --> 00:00:21,900
It's going to clean those up right away and then going to remove a couple of new lines up there.

6
00:00:23,820 --> 00:00:24,870
OK, simple enough.

7
00:00:25,740 --> 00:00:29,910
Then if we do a quick refresh, I want to take a look at some of the other warnings we have inside of

8
00:00:29,910 --> 00:00:30,120
here.

9
00:00:30,580 --> 00:00:35,520
So one warning that we have is that we are currently defining a aero function and then immediately exporting

10
00:00:35,520 --> 00:00:40,290
it as default from inside that bundler index file that we just created a moment ago.

11
00:00:40,710 --> 00:00:41,900
Instead of react up.

12
00:00:42,120 --> 00:00:44,880
This is now flagged as being something that you might not want to do.

13
00:00:45,090 --> 00:00:47,150
There's not necessarily anything wrong with it.

14
00:00:47,190 --> 00:00:51,270
The reason that they have a warning here is essentially for debugging purposes.

15
00:00:51,600 --> 00:00:56,040
If you export an anonymous function without providing a name to it, it just makes it a little bit harder

16
00:00:56,040 --> 00:00:59,310
in the future to actually kind of figure out where that function is coming from.

17
00:00:59,490 --> 00:01:04,920
If you instead name it ahead of time, then your air trace, if an error ever occurs, will more correctly

18
00:01:04,920 --> 00:01:08,520
say, hey, an error just occurred inside of this function, inside of this file.

19
00:01:08,940 --> 00:01:13,590
So this morning, right here, not super necessary, but we'll go ahead and follow its advice anyhow.

20
00:01:14,190 --> 00:01:20,550
So back inside of our bundler index file, rather than just declaring our function and immediately exporting

21
00:01:20,550 --> 00:01:22,980
it just to rename it to bundle.

22
00:01:24,390 --> 00:01:25,860
And then we'll export default.

23
00:01:27,130 --> 00:01:28,180
Bundle at the bottom.

24
00:01:31,330 --> 00:01:33,880
Now, if we refresh, no more warning, very good.

25
00:01:35,250 --> 00:01:39,780
OK, now, like I said, there's one other little thing I want to do, not tied to any warnings.

26
00:01:40,770 --> 00:01:44,670
If we take a look at our project structure now, you'll notice that we've got that bundler directory

27
00:01:44,940 --> 00:01:50,550
and as a sibling to it is the plugins folder, these plug ins folder, plug in folder right here are

28
00:01:50,550 --> 00:01:52,220
all about working with the bundler.

29
00:01:52,230 --> 00:01:55,920
But right now, that doesn't really appear that they are very much tied together.

30
00:01:56,280 --> 00:02:02,700
So I just want to drag and drop or essentially move the plugins folder into the bundler directory just

31
00:02:02,710 --> 00:02:07,920
to make sure that it's very clear, hey, everything inside this bundler directory is all about bundling

32
00:02:07,920 --> 00:02:08,990
and transpiring code.

33
00:02:09,509 --> 00:02:10,650
So just a little drag and drop.

34
00:02:10,650 --> 00:02:11,400
That's pretty much it.

35
00:02:12,330 --> 00:02:17,550
I'm going to drag plug ins, drop it into bundler, my editor is going to ask me if I actually want

36
00:02:17,550 --> 00:02:18,470
to move this folder.

37
00:02:18,510 --> 00:02:19,050
I do.

38
00:02:19,590 --> 00:02:24,720
And then after that, it might also ask me if I want to automatically update any import statements.

39
00:02:25,320 --> 00:02:30,020
I'm going to say no just so we can go through together and update these import statements together.

40
00:02:30,030 --> 00:02:30,940
I'm going to update the manual.

41
00:02:30,970 --> 00:02:33,060
Just make sure it's super clear what needs to be changed.

42
00:02:33,510 --> 00:02:35,690
I'm going to say, no, don't do any updates for me.

43
00:02:36,570 --> 00:02:44,010
Now, if we open up our index file inside a bundler, we will see two error messages right here.

44
00:02:44,610 --> 00:02:49,620
We just have to change those two saying in the current directory, look for plug ins and find the relevant

45
00:02:49,620 --> 00:02:50,610
plug in inside their.

46
00:02:53,070 --> 00:02:54,000
All right, looks good.

47
00:02:54,540 --> 00:03:01,660
So, as usual, one more test to make sure that we didn't break anything with a log on to three in to

48
00:03:01,680 --> 00:03:02,310
submit that.

49
00:03:02,490 --> 00:03:03,450
Yep, still works.

50
00:03:04,200 --> 00:03:04,590
All right.

51
00:03:04,590 --> 00:03:08,400
So we definitely have, without a doubt, a better project structure.

52
00:03:08,400 --> 00:03:13,630
Now, everything is a little bit better organized and we've pulled out a ton of logic from our app component.

53
00:03:14,490 --> 00:03:18,420
Now, I think that we've now that we've got this kind of like intermediate refactor out of the way,

54
00:03:18,420 --> 00:03:22,320
we can start to think about adding in some more features to our app in the next video.

