1
00:00:02,140 --> 00:00:04,290
All right, so we've seen named exports,

2
00:00:04,290 --> 00:00:06,210
and the struggle with named exports is

3
00:00:06,210 --> 00:00:08,830
that you have to know what the names or

4
00:00:08,830 --> 00:00:11,460
the things are inside that module before

5
00:00:11,460 --> 00:00:13,410
you can use it, and I don't necessarily

6
00:00:13,410 --> 00:00:16,850
want to do that. So, there we have default

7
00:00:16,850 --> 00:00:18,530
exports, and that's what we're going to

8
00:00:18,530 --> 00:00:21,190
play with now is how do I export something

9
00:00:21,190 --> 00:00:22,870
and say this is the default thing that you

10
00:00:22,870 --> 00:00:25,750
get when you go. And you may imagine from

11
00:00:25,750 --> 00:00:28,910
the name it involves using the keyword

12
00:00:28,910 --> 00:00:31,840
default, and you'd be totally right. So

13
00:00:31,840 --> 00:00:33,230
let's look at this for just a second. I'm

14
00:00:33,230 --> 00:00:35,780
going to comment this line out, and then I

15
00:00:35,780 --> 00:00:37,880
come up here to getSessions. Now with

16
00:00:37,880 --> 00:00:42,140
default, I can just do this, export

17
00:00:42,140 --> 00:00:45,260
default getSessions, right? And what that

18
00:00:45,260 --> 00:00:49,640
means is now if I do an import from

19
00:00:49,640 --> 00:00:53,400
sessionRepository, I'm going to get this

20
00:00:53,400 --> 00:00:55,110
function, and I don't have to know the

21
00:00:55,110 --> 00:00:58,060
name of this function, I just get this

22
00:00:58,060 --> 00:01:01,660
function, and the same thing that works

23
00:01:01,660 --> 00:01:04,490
for any part of this, const sessionURL

24
00:01:04,490 --> 00:01:07,430
export default. Now you can only export

25
00:01:07,430 --> 00:01:10,050
one thing as the default, you can't export

26
00:01:10,050 --> 00:01:12,760
a bunch of things as default, it wouldn't

27
00:01:12,760 --> 00:01:15,980
work. What would you get? So, let's go

28
00:01:15,980 --> 00:01:18,130
back down here. This is one way to do it.

29
00:01:18,130 --> 00:01:20,790
And I would do an import, notice import

30
00:01:20,790 --> 00:01:23,510
sessions, right, that's how that works.

31
00:01:23,510 --> 00:01:27,060
And so my other option is if I come down

32
00:01:27,060 --> 00:01:33,680
here, if I keep this mentality around it,

33
00:01:33,680 --> 00:01:39,790
I can say as default. And now I'm

34
00:01:39,790 --> 00:01:44,210
exporting getSessions as default, and same

35
00:01:44,210 --> 00:01:46,890
import, it works the same way, but now

36
00:01:46,890 --> 00:01:48,730
this is my default thing. Now, I can also

37
00:01:48,730 --> 00:01:51,400
come in here and I could do my named

38
00:01:51,400 --> 00:01:56,840
exports too. I can still export my

39
00:01:56,840 --> 00:01:59,410
sessionURL, but my getSessions is my

40
00:01:59,410 --> 00:02:02,000
default. And so that's what we're going to

41
00:02:02,000 --> 00:02:04,480
do. And the purpose of default is just to

42
00:02:04,480 --> 00:02:08,860
simplify up how you're doing your imports,

43
00:02:08,860 --> 00:02:11,300
right? I don't want to have to expose

44
00:02:11,300 --> 00:02:13,820
everything out to everybody else, I just

45
00:02:13,820 --> 00:02:16,920
want to have, you know, hey, just just

46
00:02:16,920 --> 00:02:18,830
call my module and I'm going to give you

47
00:02:18,830 --> 00:02:20,000
this thing and you don't have to worry

48
00:02:20,000 --> 00:02:22,320
about what it's called, just call it

49
00:02:22,320 --> 00:02:24,370
whatever you want on the other side. So

50
00:02:24,370 --> 00:02:27,890
that's a default export. And when we go

51
00:02:27,890 --> 00:02:32,000
over to the import side, we'll put that into practice.

