All language subtitles for 004 Creating a new React Project_en

af Afrikaans
sq Albanian
am Amharic
ar Arabic Download
hy Armenian Download
az Azerbaijani
eu Basque
be Belarusian
bn Bengali
bs Bosnian
bg Bulgarian
ca Catalan
ceb Cebuano
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
tl Filipino
fi Finnish
fr French
fy Frisian
gl Galician
ka Georgian
de German
el Greek
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
km Khmer
ko Korean
ku Kurdish (Kurmanji)
ky Kyrgyz
lo Lao
la Latin
lv Latvian
lt Lithuanian
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mn Mongolian
my Myanmar (Burmese)
ne Nepali
no Norwegian
ps Pashto
fa Persian Download
pl Polish
pt Portuguese
pa Punjabi
ro Romanian
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
st Sesotho
sn Shona
sd Sindhi
si Sinhala
sk Slovak
sl Slovenian
so Somali
es Spanish
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
te Telugu
th Thai
tr Turkish
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
or Odia (Oriya)
rw Kinyarwanda
tk Turkmen
tt Tatar
ug Uyghur
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:02,320 --> 00:00:06,100 Now to start our work on this course project 2 00:00:06,100 --> 00:00:09,300 and to finally start writing some React code 3 00:00:09,300 --> 00:00:11,350 we need a React project. 4 00:00:11,350 --> 00:00:15,870 And the easiest way of getting started with a React project 5 00:00:15,870 --> 00:00:19,870 is to use a tool called Create React App. 6 00:00:19,870 --> 00:00:22,810 You can simply Google for a Create React App 7 00:00:22,810 --> 00:00:24,910 to find this GitHub repository 8 00:00:24,910 --> 00:00:27,340 with more information about it. 9 00:00:27,340 --> 00:00:31,620 You can also visit, create-React-app.dev 10 00:00:31,620 --> 00:00:34,200 for the full documentation. 11 00:00:34,200 --> 00:00:35,860 Now this is a tool which you can use 12 00:00:35,860 --> 00:00:38,490 to create React projects. 13 00:00:38,490 --> 00:00:41,770 Which are basically pre-configured folders 14 00:00:41,770 --> 00:00:46,770 with some basic React code files and most importantly 15 00:00:47,610 --> 00:00:51,970 a bunch of configuration files which help you build 16 00:00:51,970 --> 00:00:55,320 that React App for production use 17 00:00:55,320 --> 00:00:57,960 because it turns out that there will be 18 00:00:57,960 --> 00:01:01,850 a couple of transformation and optimization steps 19 00:01:01,850 --> 00:01:04,310 between developing any React App 20 00:01:04,310 --> 00:01:06,840 and running a React App in production 21 00:01:06,840 --> 00:01:08,590 but more on that later. 22 00:01:08,590 --> 00:01:12,060 And in addition, this project which is created 23 00:01:12,060 --> 00:01:14,610 with Create React App, will give you 24 00:01:14,610 --> 00:01:17,390 a nice development environment 25 00:01:17,390 --> 00:01:21,830 with a development web server which allows you to preview 26 00:01:21,830 --> 00:01:25,000 the application locally on your machine. 27 00:01:25,000 --> 00:01:28,170 And it will allow you to preview this application 28 00:01:28,170 --> 00:01:32,540 in a way where the browser will automatically update 29 00:01:32,540 --> 00:01:36,080 the page whenever you make changes in your code and so on. 30 00:01:36,080 --> 00:01:39,810 That's why we use a tool like Create React App. 31 00:01:39,810 --> 00:01:43,670 It simply simplifies our development process. 32 00:01:43,670 --> 00:01:48,010 It adds a couple of key transformation steps which we need 33 00:01:48,010 --> 00:01:52,570 and it will later also help us optimize our React code 34 00:01:52,570 --> 00:01:56,410 before we push it to a production server. 35 00:01:56,410 --> 00:02:00,370 Now getting started with Create React App is simple. 36 00:02:00,370 --> 00:02:03,730 In the end you find all important steps here. 37 00:02:03,730 --> 00:02:06,180 However, to execute these steps 38 00:02:06,180 --> 00:02:10,383 you first of all need to visit nodejs.org. 39 00:02:11,390 --> 00:02:15,580 Node js is a technology which is not directly 40 00:02:15,580 --> 00:02:17,390 related to React. 41 00:02:17,390 --> 00:02:20,530 It isn't the end a runtime for JavaScript 42 00:02:20,530 --> 00:02:23,530 which would allow you to run JavaScript code 43 00:02:23,530 --> 00:02:25,350 outside of the browser. 44 00:02:25,350 --> 00:02:28,850 And therefore of course, it's not something we need at all 45 00:02:28,850 --> 00:02:30,170 for React. 46 00:02:30,170 --> 00:02:32,770 Because React code is JavaScript code 47 00:02:32,770 --> 00:02:35,400 that runs in the browser. 48 00:02:35,400 --> 00:02:37,890 We will need node js however, 49 00:02:37,890 --> 00:02:40,820 for this Create React App tool. 50 00:02:40,820 --> 00:02:44,780 To run this command here we'll need node js installed 51 00:02:44,780 --> 00:02:47,470 on our system, otherwise this will fail. 52 00:02:47,470 --> 00:02:49,630 And behind the scenes the project 53 00:02:49,630 --> 00:02:52,530 which is generated by a Create React App 54 00:02:52,530 --> 00:02:57,300 will use node js for this development preview server 55 00:02:57,300 --> 00:03:00,550 and for this behind the scenes transformation 56 00:03:00,550 --> 00:03:03,900 and optimization steps which we also need 57 00:03:03,900 --> 00:03:07,370 to build production ready applications. 58 00:03:07,370 --> 00:03:10,140 Therefore you should visit nodejs.org 59 00:03:10,140 --> 00:03:13,520 and simply download that latest version here 60 00:03:13,520 --> 00:03:17,070 whichever version that is when you were visiting this page 61 00:03:17,070 --> 00:03:19,620 the exact version doesn't matter. 62 00:03:19,620 --> 00:03:22,330 Simply download this version here 63 00:03:22,330 --> 00:03:24,600 save it somewhere on your system 64 00:03:24,600 --> 00:03:28,160 and walk through the installer this gives you. 65 00:03:28,160 --> 00:03:32,010 I'm on macOS here but you'll get a similar installer 66 00:03:32,010 --> 00:03:35,613 on windows and you should simply walk through the installer 67 00:03:35,613 --> 00:03:39,210 except all these default settings here 68 00:03:39,210 --> 00:03:43,340 and in the end simply finished as node js installation. 69 00:03:43,340 --> 00:03:47,220 Again, it works in the same way on macOS and Linux 70 00:03:47,220 --> 00:03:48,690 and windows. 71 00:03:48,690 --> 00:03:53,690 Once you've got node js installed, you are ready to execute 72 00:03:54,460 --> 00:03:58,720 these commands to create a new React application 73 00:03:58,720 --> 00:04:02,740 and therefor a new folder, to then navigate into that folder 74 00:04:02,740 --> 00:04:06,260 and to then run a special script, which exists inside 75 00:04:06,260 --> 00:04:09,740 of that project folder to bring up a development server 76 00:04:09,740 --> 00:04:12,940 this preview server I was talking about. 77 00:04:12,940 --> 00:04:15,660 But we are going to do that together. 78 00:04:15,660 --> 00:04:19,790 So simply copy this command and then open 79 00:04:19,790 --> 00:04:23,960 your default terminal or command prompt on windows 80 00:04:23,960 --> 00:04:28,820 and then important, navigate inside of this terminal 81 00:04:28,820 --> 00:04:33,030 into a folder where you want to create your React project. 82 00:04:33,030 --> 00:04:35,600 You can navigate around with this cd command 83 00:04:35,600 --> 00:04:37,920 which stands for change directory 84 00:04:37,920 --> 00:04:40,920 and you then should ultimately go into a path 85 00:04:40,920 --> 00:04:43,880 where you do want to create this new project. 86 00:04:43,880 --> 00:04:48,050 For me I'll just navigate into my desktop folder here 87 00:04:48,050 --> 00:04:51,180 and then simply copy in this NPX command. 88 00:04:51,180 --> 00:04:55,410 However, I'll change the name of the to be created project 89 00:04:55,410 --> 00:05:00,323 to React complete guide, since that is what this course is. 90 00:05:01,620 --> 00:05:03,480 Simply hit entered there after 91 00:05:03,480 --> 00:05:06,630 and this will now create this new React project 92 00:05:06,630 --> 00:05:09,710 in the destination where you execute this command. 93 00:05:09,710 --> 00:05:13,160 It will create a folder with that name you picked here 94 00:05:13,160 --> 00:05:15,400 in my case, react complete guide. 95 00:05:15,400 --> 00:05:19,020 And inside of that folder, it'll set up all the key files 96 00:05:19,020 --> 00:05:21,210 you need to write React code 97 00:05:21,210 --> 00:05:23,550 and build your React application. 98 00:05:23,550 --> 00:05:25,760 Now, as you can see, this might take 99 00:05:25,760 --> 00:05:28,000 a couple of minutes here to finish 100 00:05:28,000 --> 00:05:30,690 and therefore I will be back once it is finished. 101 00:05:30,690 --> 00:05:34,130 If you are facing errors here, definitely also 102 00:05:34,130 --> 00:05:37,413 check the Q and A section, but most importantly make sure 103 00:05:37,413 --> 00:05:41,610 that you don't have a proxy firewall or VPN client 104 00:05:41,610 --> 00:05:43,940 that might be blocking outgoing connections 105 00:05:43,940 --> 00:05:45,750 or might be interfering here. 106 00:05:45,750 --> 00:05:48,513 The same goes for antivirus software. 107 00:05:49,540 --> 00:05:53,520 Now, once this finished, you should see something like this 108 00:05:53,520 --> 00:05:57,870 and you can now cd introduce created folder 109 00:05:57,870 --> 00:06:01,440 simply by running cd and then the folder name. 110 00:06:01,440 --> 00:06:04,443 And then in there run NPM start. 111 00:06:05,490 --> 00:06:08,440 And this will now start this development server 112 00:06:08,440 --> 00:06:12,540 which hosts a preview of this React application. 113 00:06:12,540 --> 00:06:15,040 And it will automatically open up this application 114 00:06:15,040 --> 00:06:18,320 on localhost:3000. 115 00:06:18,320 --> 00:06:21,210 If it doesn't open this page automatically 116 00:06:21,210 --> 00:06:26,130 you can manually visit localhost:3000 in your browser. 117 00:06:26,130 --> 00:06:28,770 Now there, you should see something like this 118 00:06:28,770 --> 00:06:32,030 the exact look and what you see in detail here might change 119 00:06:32,030 --> 00:06:35,070 over time, but you should see some starting page 120 00:06:35,070 --> 00:06:38,750 some dummy React application, which has set up for you. 121 00:06:38,750 --> 00:06:41,700 Now, of course, we're ready to edit this code. 122 00:06:41,700 --> 00:06:45,730 And for this, I already recommended visual studio code 123 00:06:45,730 --> 00:06:49,328 as a code editor in the first code section. 124 00:06:49,328 --> 00:06:53,060 (indistinct) I also explain my visual studio code set up 125 00:06:53,060 --> 00:06:56,020 and how you can make sure that it looks and works for you 126 00:06:56,020 --> 00:06:58,040 as it does for me. 127 00:06:58,040 --> 00:07:00,190 So on code dot visual studio.com 128 00:07:00,190 --> 00:07:03,627 you can download and installed it for all operating systems. 129 00:07:03,627 --> 00:07:06,180 But again, make sure you have a look 130 00:07:06,180 --> 00:07:08,910 at this first core section where I walked 131 00:07:08,910 --> 00:07:10,473 through that in detail. 132 00:07:11,340 --> 00:07:13,890 Therefore, once you did all of that 133 00:07:13,890 --> 00:07:17,230 simply open visual studio code and then opened 134 00:07:17,230 --> 00:07:20,930 this created project folder with visual studio code. 135 00:07:20,930 --> 00:07:24,860 simply with file, open and then pick that folder 136 00:07:24,860 --> 00:07:28,570 which was created, which holds your React project. 137 00:07:28,570 --> 00:07:30,810 And you should see something like this there. 138 00:07:30,810 --> 00:07:33,820 You might not see all these sub folders and files 139 00:07:33,820 --> 00:07:35,980 as this can also change over time 140 00:07:35,980 --> 00:07:39,950 but you should definitely see a source, a SRC folder 141 00:07:39,950 --> 00:07:42,360 and the package.json file. 142 00:07:42,360 --> 00:07:46,650 The package.json file in the end holds all the dependencies 143 00:07:46,650 --> 00:07:49,990 of this project, for example, React, but also a couple 144 00:07:49,990 --> 00:07:52,590 of development dependencies, which are involved 145 00:07:52,590 --> 00:07:55,290 with these transformation and optimization steps 146 00:07:55,290 --> 00:07:56,860 I was talking about. 147 00:07:56,860 --> 00:08:00,420 The SRC folder holds the actual source code 148 00:08:00,420 --> 00:08:01,490 you will be working on. 149 00:08:01,490 --> 00:08:04,390 And you will see more files in there than I have it here 150 00:08:04,390 --> 00:08:06,750 because I already cleaned up that folder. 151 00:08:06,750 --> 00:08:09,630 And speaking of that, I wanted to show you 152 00:08:09,630 --> 00:08:12,210 how you can create new React projects 153 00:08:12,210 --> 00:08:14,970 because ultimately that is what you need once you're done 154 00:08:14,970 --> 00:08:18,820 with that course, but to make sure that we're all starting 155 00:08:18,820 --> 00:08:21,210 on the same page and we're all working 156 00:08:21,210 --> 00:08:23,630 on the same kind of project setup 157 00:08:23,630 --> 00:08:27,580 attached you find this cleaned up starting project 158 00:08:27,580 --> 00:08:30,060 which I created for you. 159 00:08:30,060 --> 00:08:33,929 Simply download it unzip it and then open that 160 00:08:33,929 --> 00:08:35,490 with visual studio code. 161 00:08:35,490 --> 00:08:38,130 That's the project we should continue on 162 00:08:38,130 --> 00:08:42,169 because here we'll all have the exact same starting state 163 00:08:42,169 --> 00:08:44,550 and you will learn the latest version 164 00:08:44,550 --> 00:08:46,960 of React with that as well. 165 00:08:46,960 --> 00:08:49,640 So make sure you download unzip and open 166 00:08:49,640 --> 00:08:52,990 that attached starting project, which is this cleaned up 167 00:08:52,990 --> 00:08:57,143 project, originally created with Create React App. 168 00:08:58,300 --> 00:08:59,660 Once you did that 169 00:08:59,660 --> 00:09:02,830 make sure you cancel that running development server 170 00:09:02,830 --> 00:09:05,530 which we started a couple of seconds ago 171 00:09:05,530 --> 00:09:08,510 by going to the terminal where this server is running 172 00:09:08,510 --> 00:09:10,470 and hit control C in there. 173 00:09:10,470 --> 00:09:12,760 Which will cancel it and now, by the way, 174 00:09:12,760 --> 00:09:15,990 if you reload localhost:3000, you'll no longer see 175 00:09:15,990 --> 00:09:17,700 the website therefore. 176 00:09:17,700 --> 00:09:19,690 But we'll restart it in a second. 177 00:09:19,690 --> 00:09:22,620 But now based on this adjusted starting project 178 00:09:22,620 --> 00:09:24,490 I provided to you. 179 00:09:24,490 --> 00:09:27,460 Now here's a nice trick which I recommend that you use. 180 00:09:27,460 --> 00:09:30,380 We again, need to start this development server 181 00:09:30,380 --> 00:09:33,240 to have that automatically updated preview 182 00:09:33,240 --> 00:09:35,616 of the application we're building. 183 00:09:35,616 --> 00:09:38,690 Now the best way of starting that server again 184 00:09:38,690 --> 00:09:41,010 is to go into visual studio code 185 00:09:41,010 --> 00:09:43,120 into that project which you opened up. 186 00:09:43,120 --> 00:09:48,120 And then here in the menu, go to terminal, new terminal 187 00:09:48,480 --> 00:09:50,600 and open a new terminal here 188 00:09:50,600 --> 00:09:55,230 which is now your default system terminal or command prompt 189 00:09:55,230 --> 00:09:58,740 just integrated into visual studio code. 190 00:09:58,740 --> 00:10:02,500 And in there you need to run two commands. 191 00:10:02,500 --> 00:10:06,370 First of all run NPM install, this will look into 192 00:10:06,370 --> 00:10:10,050 the package.json file and download and install 193 00:10:10,050 --> 00:10:12,313 all the required packages and dependencies 194 00:10:12,313 --> 00:10:16,770 into this project folder, simply entered this and hit enter. 195 00:10:16,770 --> 00:10:18,830 We didn't have to do this earlier 196 00:10:18,830 --> 00:10:21,810 because when we ran NPX Create React App 197 00:10:21,810 --> 00:10:26,110 this was already included in the overall setup process. 198 00:10:26,110 --> 00:10:29,060 Now that I shared my starting project with you 199 00:10:29,060 --> 00:10:31,240 you need to run this once to download 200 00:10:31,240 --> 00:10:33,260 and install all the dependencies. 201 00:10:33,260 --> 00:10:35,980 They are not part of the shared zip file 202 00:10:35,980 --> 00:10:39,363 since that would unnecessarily bloat that zip file. 203 00:10:40,460 --> 00:10:43,270 Indeed all course attachments which you find 204 00:10:43,270 --> 00:10:45,610 will be missing these locally downloaded 205 00:10:45,610 --> 00:10:47,430 and installed dependencies 206 00:10:47,430 --> 00:10:50,410 since that would just increase the zip file size 207 00:10:50,410 --> 00:10:53,370 and in the end, you just need to run NPM install 208 00:10:53,370 --> 00:10:56,820 in the downloaded and extracted zip files to recreate 209 00:10:56,820 --> 00:10:59,680 and re-download all the dependencies. 210 00:10:59,680 --> 00:11:02,400 You will now have a node modules folder here 211 00:11:02,400 --> 00:11:04,600 which holds all these dependencies. 212 00:11:04,600 --> 00:11:08,140 That's by the way a folder you should never edit or work in 213 00:11:08,140 --> 00:11:11,820 because that's really just all these third party packages 214 00:11:11,820 --> 00:11:14,053 downloaded onto your local system. 215 00:11:15,620 --> 00:11:19,150 Now, once that's done, you can run NPM start again 216 00:11:19,150 --> 00:11:22,170 and this will again, bring up this development server. 217 00:11:22,170 --> 00:11:25,500 Use it all to keep that development server running as long 218 00:11:25,500 --> 00:11:28,300 as you're working on the code, because if you shut it down 219 00:11:28,300 --> 00:11:30,690 you can't preview your application anymore 220 00:11:30,690 --> 00:11:34,410 though you can always restart it by running NPM start again. 221 00:11:34,410 --> 00:11:37,370 And as long as this process is running here 222 00:11:37,370 --> 00:11:40,320 it will automatically watch your code files. 223 00:11:40,320 --> 00:11:42,580 And whenever you change something in code 224 00:11:42,580 --> 00:11:46,340 it will automatically update the loaded page in the browser. 225 00:11:46,340 --> 00:11:48,550 So keep this process up and running here. 226 00:11:48,550 --> 00:11:50,150 Don't close this terminal. 227 00:11:50,150 --> 00:11:52,360 Don't quit it with control C 228 00:11:52,360 --> 00:11:54,133 unless you're done for the day. 229 00:11:55,200 --> 00:11:59,010 Now on localhost:3000, you should see something like this. 230 00:11:59,010 --> 00:12:01,480 Simply some 'let's get started' text 231 00:12:01,480 --> 00:12:03,870 which isn't particularly easy to read 232 00:12:03,870 --> 00:12:06,380 but that's really just a dummy starting state 233 00:12:06,380 --> 00:12:08,180 on which we're going to build up on. 234 00:12:09,980 --> 00:12:12,680 And that is the starting project we're now 235 00:12:12,680 --> 00:12:14,020 going to work with. 236 00:12:14,020 --> 00:12:18,050 That's now our starting state, where we can now finally dive 237 00:12:18,050 --> 00:12:21,503 into the React source code and start learning React. 19506

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.