All language subtitles for 002 Understanding React Error Messages_en

af Afrikaans
sq Albanian
am Amharic
ar Arabic
hy Armenian
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 Download
jw Javanese
kn Kannada
kk Kazakh
km Khmer
ko Korean Download
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,090 --> 00:00:05,200 Let's start with error messages. 2 00:00:05,200 --> 00:00:08,810 Attached, you find a project, this project here 3 00:00:08,810 --> 00:00:10,930 which is a slightly altered version, 4 00:00:10,930 --> 00:00:14,243 of the project we worked on over the last modules. 5 00:00:15,210 --> 00:00:20,210 Now in this attached project, I added a couple of errors, 6 00:00:20,840 --> 00:00:22,480 a couple of problems. 7 00:00:22,480 --> 00:00:25,000 And therefore if you run NPM install, 8 00:00:25,000 --> 00:00:27,260 and thereafter NPM start, 9 00:00:27,260 --> 00:00:31,473 you will immediately get an error here in your terminal. 10 00:00:32,350 --> 00:00:35,920 If you visit the application in the browser 11 00:00:35,920 --> 00:00:39,860 you will also basically get the same error output there, 12 00:00:39,860 --> 00:00:42,170 instead of the application. 13 00:00:42,170 --> 00:00:44,450 And that is a common thing. 14 00:00:44,450 --> 00:00:48,290 Sometimes when you're writing code, you get errors. 15 00:00:48,290 --> 00:00:50,870 Errors which React catches 16 00:00:50,870 --> 00:00:55,870 or the React development process catches and froze at you. 17 00:00:56,620 --> 00:00:59,650 And as I mentioned before, often 18 00:00:59,650 --> 00:01:02,790 in the Q and A section of my courses, for example 19 00:01:02,790 --> 00:01:05,250 I see students who immediately panic, 20 00:01:05,250 --> 00:01:06,870 when they see an error message, 21 00:01:06,870 --> 00:01:09,380 and they don't read it themselves. 22 00:01:09,380 --> 00:01:12,180 They don't try to solve it themselves. 23 00:01:12,180 --> 00:01:15,530 Instead, they immediately create a new thread 24 00:01:15,530 --> 00:01:17,310 and ask for help. 25 00:01:17,310 --> 00:01:19,380 This will not help you as a developer. 26 00:01:19,380 --> 00:01:21,730 This will not make you a better developer. 27 00:01:21,730 --> 00:01:24,780 It will actually make you a worse developer. 28 00:01:24,780 --> 00:01:27,370 You need to be able to understand 29 00:01:27,370 --> 00:01:29,820 and solve errors on your own. 30 00:01:29,820 --> 00:01:33,450 So let's for example, have a look at this error message. 31 00:01:33,450 --> 00:01:35,150 It failed to compile 32 00:01:35,150 --> 00:01:37,950 and that's why we can't see the application. 33 00:01:37,950 --> 00:01:41,870 And the problem we have is that we have a parsing error. 34 00:01:41,870 --> 00:01:44,320 Adjacent JSX elements, 35 00:01:44,320 --> 00:01:46,813 must be wrapped in an in closing tag. 36 00:01:47,810 --> 00:01:51,130 Did you want a JSX fragment? 37 00:01:51,130 --> 00:01:54,340 Okay. We haven't heard about JSX fragments yet. 38 00:01:54,340 --> 00:01:57,380 This is something I'll cover later in the course. 39 00:01:57,380 --> 00:01:59,090 But we also have that first part 40 00:01:59,090 --> 00:02:01,260 and we can make sense of that. 41 00:02:01,260 --> 00:02:06,260 Adjacent, which means side-by-side JSX elements, 42 00:02:06,510 --> 00:02:10,330 must be wrapped in an in closing tag. 43 00:02:10,330 --> 00:02:12,990 And we also get a hint at the file. 44 00:02:12,990 --> 00:02:16,480 And the line of code this error is stemming from. 45 00:02:16,480 --> 00:02:20,550 We even see the code snippet here below the message. 46 00:02:20,550 --> 00:02:23,600 We see that it comes from app JS, 47 00:02:23,600 --> 00:02:27,080 and there line 43, column seven. 48 00:02:27,080 --> 00:02:31,310 That column part is not that important, but line 43. 49 00:02:31,310 --> 00:02:35,750 And if I go to my app JS file, we see here, line 43. 50 00:02:35,750 --> 00:02:38,510 Even my IDE detects this error. 51 00:02:38,510 --> 00:02:43,440 Now as a side note, this is an error my IDE able to detect. 52 00:02:43,440 --> 00:02:46,550 It won't detect all React errors though. 53 00:02:46,550 --> 00:02:48,210 So sometimes you get an error, 54 00:02:48,210 --> 00:02:50,010 which is not showing up in your IDE. 55 00:02:51,000 --> 00:02:54,820 But here I get an error which has shown in the IDE, 56 00:02:54,820 --> 00:02:56,610 which has also shown in the snippet 57 00:02:56,610 --> 00:03:00,010 which is pointed at, by this line code here. 58 00:03:00,010 --> 00:03:01,970 And which I also see here in the browser. 59 00:03:01,970 --> 00:03:03,830 It also shows me that snippet, 60 00:03:03,830 --> 00:03:08,180 that file name and that line information. 61 00:03:08,180 --> 00:03:10,810 I get all of that here as well. 62 00:03:10,810 --> 00:03:13,070 So what is wrong here? 63 00:03:13,070 --> 00:03:16,910 Well, there seems to be a rule in React that forces us 64 00:03:16,910 --> 00:03:21,030 to basically wrap neighboring side-by-side elements, 65 00:03:21,030 --> 00:03:22,810 in one surrounding element. 66 00:03:22,810 --> 00:03:25,310 And here, the problem is that we have a section, 67 00:03:25,310 --> 00:03:26,960 next to a section. 68 00:03:26,960 --> 00:03:29,880 And such adjacent JSX element, 69 00:03:29,880 --> 00:03:31,849 which you return are not allowed. 70 00:03:31,849 --> 00:03:36,849 Instead, you need to wrap them in one root element. 71 00:03:36,940 --> 00:03:39,440 Now in there, you can have side by side elements. 72 00:03:39,440 --> 00:03:44,310 But whenever you return JSX or use store JSX and a variable, 73 00:03:44,310 --> 00:03:48,000 you must only have one root element in there, 74 00:03:48,000 --> 00:03:50,950 which then can wrap adjacent elements. 75 00:03:50,950 --> 00:03:53,610 That is a hard rule you have in React. 76 00:03:53,610 --> 00:03:54,970 And as a side note, 77 00:03:54,970 --> 00:03:57,740 and I will dive into that in more detail later. 78 00:03:57,740 --> 00:04:00,440 But as a side note, we have that rule, 79 00:04:00,440 --> 00:04:01,643 because behind the scenes, 80 00:04:01,643 --> 00:04:03,735 this is this React create element code, 81 00:04:03,735 --> 00:04:05,394 I showed you earlier. 82 00:04:05,394 --> 00:04:09,480 And you can't have two statements side by side, 83 00:04:09,480 --> 00:04:11,640 being returned by one return statement either, 84 00:04:11,640 --> 00:04:12,600 for example. 85 00:04:12,600 --> 00:04:17,240 And that is what two sections, two adjacent sections 86 00:04:17,240 --> 00:04:18,490 would be translated to. 87 00:04:18,490 --> 00:04:19,730 And that's the reason. 88 00:04:19,730 --> 00:04:23,050 But we'll have a look at that in more detail, later. 89 00:04:23,050 --> 00:04:25,594 But this is an error we are able to fix, 90 00:04:25,594 --> 00:04:28,910 even without fully understanding where it's coming from. 91 00:04:28,910 --> 00:04:31,990 Because the error message clearly tells us, 92 00:04:31,990 --> 00:04:36,460 that we need an enclosing, so a rapping tag. 93 00:04:36,460 --> 00:04:39,990 And as soon as they do add such a tag, for example, a div, 94 00:04:39,990 --> 00:04:43,760 I'm able to save this and it now compiled successfully 95 00:04:43,760 --> 00:04:46,053 and my app is back up and running. 96 00:04:47,460 --> 00:04:51,910 So that is an example of a React error message, 97 00:04:51,910 --> 00:04:56,130 which we just had to read, and we were able to solve it. 98 00:04:56,130 --> 00:04:59,920 Now our common mistakes that are often made are, for example 99 00:04:59,920 --> 00:05:03,130 incorrect names of functions you're pointing at. 100 00:05:03,130 --> 00:05:03,963 Let's say here, 101 00:05:03,963 --> 00:05:06,950 we're pointing at the addGoalsHandler function. 102 00:05:06,950 --> 00:05:09,533 When it's actually named addGoalHandler. 103 00:05:10,790 --> 00:05:12,330 A simple typo. 104 00:05:12,330 --> 00:05:14,470 Again, my IDE detects it. 105 00:05:14,470 --> 00:05:17,730 It gives me a clear indicator that something's wrong here. 106 00:05:17,730 --> 00:05:19,380 And therefore we should check this 107 00:05:19,380 --> 00:05:22,360 and check it for typos, for example. 108 00:05:22,360 --> 00:05:23,860 But if I would save it nonetheless, 109 00:05:23,860 --> 00:05:26,970 again we get a compilation error also here. 110 00:05:26,970 --> 00:05:30,800 And we see that addGoalsHandler is not defined. 111 00:05:30,800 --> 00:05:33,760 Again, this is a pretty clear error message. 112 00:05:33,760 --> 00:05:37,700 We clearly are trying to use something, some variable, 113 00:05:37,700 --> 00:05:40,090 which isn't found by React. 114 00:05:40,090 --> 00:05:42,040 And then again, you should go to that place 115 00:05:42,040 --> 00:05:44,310 and check why it's not found. 116 00:05:44,310 --> 00:05:46,250 Maybe you have a typo. 117 00:05:46,250 --> 00:05:48,616 Maybe you forgot to define such a function 118 00:05:48,616 --> 00:05:50,548 or variable altogether. 119 00:05:50,548 --> 00:05:52,710 So here it's a typo. 120 00:05:52,710 --> 00:05:55,290 If you fix it, it compiles again. 121 00:05:55,290 --> 00:05:58,470 So don't panic, read error messages, 122 00:05:58,470 --> 00:06:01,290 have a look at the line or the file it's coming from, 123 00:06:01,290 --> 00:06:03,900 have a look at the code snippet it might be showing you 124 00:06:03,900 --> 00:06:07,270 and then look at the problematic code part, 125 00:06:07,270 --> 00:06:09,340 at the problematic code snippet. 126 00:06:09,340 --> 00:06:10,940 Look at the error message, 127 00:06:10,940 --> 00:06:14,150 connect the error message to the snippet it's pointing at, 128 00:06:14,150 --> 00:06:17,773 and you will be able to solve most errors. 10035

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