text
stringlengths
1
81
start
float64
0
10.1k
duration
float64
0
24.9
write React Native if you were to start your own personal project
4,166.3
4.019
or assignment for the course.
4,170.319
3.16
So I've been talking about this company called Expo quite a bit.
4,173.479
3.21
And what they do is they create a very fast way to build an app.
4,176.689
3.46
They provide a lot of tooling around React
4,180.149
1.75
Native and the React native community.
4,181.899
3.302
So there are a suite of tools to accelerate the React Native development
4,185.201
2.999
process.
4,188.2
1.047
And so one that we've been using quite a lot
4,189.247
1.833
is this thing called Snack, which is this website here.
4,191.08
3.81
We've used it this course, a lot this lecture and last.
4,194.89
5.58
And what that allows us to do is run React Native in the browser.
4,200.47
3.06
So it automatically bundles any libraries
4,203.53
2.49
that we need like React Native, React, and then
4,206.02
3.75
it also runs on a phone embedded into the browser.
4,209.77
2.55
They also give us a tool called the XDE which
4,216.1
3.03
is a GUI, graphical user interface, to serve share and publish any Expo
4,219.13
4.8
projects that you have.
4,223.93
2.31
They also give us a command line interface to do
4,226.24
2.04
the same things, to be a command line.
4,228.28
3.52
They give us the Expo client which, if you saw my email from earlier,
4,231.8
4.25
is an iPhone app that you can install and actually run stuff
4,236.05
4.29
that you write in Snack or stuff that you write and manage
4,240.34
4.29
by the XDE or the CLI to actually run it on your phone while developing
4,244.63
5.31
and before you publish.
4,249.94
2.61
And lastly they give us an SDK, software development kit,
4,252.55
3.09
which bundles and exposes cross-platform libraries and APIs.
4,255.64
3.93
And so included in that are maps, stuff for like icons and images and SVGs
4,259.57
8.01
and maybe animations.
4,267.58
1.56
They also give us handy constants.
4,269.14
1.56
So the Expo that we imported into this app is actually the SDK,
4,270.7
5.94
and it gave us a constant like, we didn't use it here
4,276.64
4.32
but, the height of the status bar.
4,280.96
3.72
And so they give us a lot of helpful things
4,284.68
2.49
to really get our developing process moving forward.
4,287.17
3.86
And so let's take a look at this thing called the XDE.
4,291.03
3.76
So I have it here.
4,294.79
1.44
It's a little bit small but basically what this is is it
4,300.07
3.9
allows us to create and run projects.
4,303.97
2.38
And so I actually already created this project before the class,
4,306.35
5.04
but when you do create your project it allows you to choose a template
4,311.39
4.16
and basically create the directory and all of its dependencies
4,315.55
5.01
on your computer.
4,320.56
1.23
And so, if you started with the blank like I did and created my new project,
4,321.79
4.53
it gives you a chance to save it wherever you'd like.
4,326.32
7.2
But I already went and did that process and created my new project.
4,333.52
2.97
And so, if you want to follow along at home,
4,336.49
2.07
you just do create new project, blank, save it wherever you like
4,338.56
3.96
and then you end up right here.
4,342.52
3.76
And basically what this is, is this is running a bunch of things
4,346.28
2.81
behind the scenes including React Native packager which handles the bundling
4,349.09
3.81
and whatnot of your app and any logs if you want to console log,
4,352.9
5.37
will also appear in this XDE.
4,358.27
2.31
And so what it's doing is it's actually looking in that directory
4,360.58
2.97
that it created on your computer.
4,363.55
2.278
And so if you create it and then CD into the correct directory on your computer
4,374.11
3.78
you end up right here.
4,377.89
1.08
And so when you create a new file you see
4,381.942
1.708
this thing called app.json which is basically
4,383.65
5.45
a bunch of metadata that's created about your project and is
4,389.1
2.5
how Expo tracks your app.
4,391.6
3.21
And then you see this thing called app.js.
4,394.81
1.75
And that is basically the bare bones React Native app that you start with.
4,400.48
6.92
And when you run it, if you open it up on a device, you see it run here.
4,407.4
8.106
And so this says, open up app.js to start working on your app.
4,418.86
3.82
And if I were to change the text here and save, we can see it re-bundle.
4,422.68
12.88
It's currently building that new JavaScript bundle
4,435.56
2.13
and then you see here, live on the phone, that you did update that text.
4,437.69
5.58
And so, if you want to start working on your project earlier
4,445.89
4.31
or work on any personal projects of your own, you're welcome to use Expo.
4,450.2
3.48
I actually encourage you to use Expo because they
4,453.68
2.79
take a lot of annoying and difficult parts
4,456.47
2.79
about creating projects and publishing them
4,459.26
1.847
and do all the hard work for you so that all you have to worry about
4,461.107
2.833
is writing the JavaScript here.
4,463.94
1.291
Cool.
4,470.33
0.99
And so we've been doing this thing a lot in this lecture and previous ones
4,471.32
4.089
called importing and exporting.
4,475.409
1.291
And we haven't actually talked about what is.
4,476.7
2.65
And so we have talked a lot about components
4,479.35
3.1
and how we should break up components.
4,482.45
2.372
And it's actually also highly encouraged that you break up the components
4,484.822
3.968
into their own files.
4,488.79
1.49
And so we've seen that components are great for simplifying your code
4,490.28
3.234
and we can actually split them into their own files.
4,493.514
2.166
And then what this allows us to do is help organize the project even more.
4,495.68
5.19
Rather than having everything all in one big super long file, which
4,500.87
3.75
might get very unwieldy, we can actually organize things
4,504.62
2.46
into their own separate files or even separate folders
4,507.08
3.57
so it's easy to find whatever code you need to update.
4,510.65
3.89
Then what we do is from the file that we create we actually
4,514.54
3.37
export the component that we want.
4,517.91
2.89
And then we can then import it in to another file if we want to use it.
4,520.8
4.82
And there are a couple different ways to import and export.
4,527.732
2.458
There's this thing called a default export,
4,530.19
2.12
and there's this thing called a named import and export.
4,532.31
2.88
And so what I was typing a lot earlier is you see me type
4,535.19
4.57
this thing called export default class app.
4,539.76
2.62
And that's me saying, hey from this file here I actually
4,542.38
3.43
want to export this app.
4,545.81
1.56