All language subtitles for 009 Utilizing Incremental Static Generation (ISR)_Downloadly.ir_en

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
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
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian Download
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:02,040 --> 00:00:04,890 So we did learn about get static props, 2 00:00:04,890 --> 00:00:08,600 and how we can use it to prepare data on the server side 3 00:00:08,600 --> 00:00:12,120 so to say, for pre-rendering the page. 4 00:00:12,120 --> 00:00:14,328 However, when I say on the server side, 5 00:00:14,328 --> 00:00:16,259 that's only partially correct. 6 00:00:16,259 --> 00:00:20,190 We can execute server-side code here, but in the end 7 00:00:20,190 --> 00:00:23,460 the code will not run on the actual server, which serves 8 00:00:23,460 --> 00:00:26,310 our application, instead it runs on our machine 9 00:00:26,310 --> 00:00:29,440 when the page is built when the application 10 00:00:29,440 --> 00:00:31,170 is built with next. 11 00:00:31,170 --> 00:00:34,860 So in the end, when you run, NPM run build. 12 00:00:34,860 --> 00:00:39,250 When you execute that prepared script here, 13 00:00:39,250 --> 00:00:44,250 which executes next build, then this code is executed. 14 00:00:44,860 --> 00:00:49,230 Now that's still good because since we have no JS installed 15 00:00:49,230 --> 00:00:51,870 all that node JS code does work here. 16 00:00:51,870 --> 00:00:56,140 So that's perfect, but it has one potential downside. 17 00:00:56,140 --> 00:01:01,030 What if you have data that changes frequently? 18 00:01:01,030 --> 00:01:05,630 Because I mean, pre-generating the pages sounds great 19 00:01:05,630 --> 00:01:08,720 if you're building something fairly static. 20 00:01:08,720 --> 00:01:10,820 If you're building a blog, where data 21 00:01:10,820 --> 00:01:13,680 doesn't change too often, then of course, 22 00:01:13,680 --> 00:01:15,930 whenever you add a new blog post, 23 00:01:15,930 --> 00:01:18,529 you can just pre-generate your project again, 24 00:01:18,529 --> 00:01:21,430 you can run NPM run build again, 25 00:01:21,430 --> 00:01:24,140 and deploy the updated project. 26 00:01:24,140 --> 00:01:25,810 So that would work. 27 00:01:25,810 --> 00:01:29,490 But if you have data that changes more frequently, 28 00:01:29,490 --> 00:01:31,740 if we add a fourth product here 29 00:01:31,740 --> 00:01:35,451 after the page was deployed, then we have to rebuild 30 00:01:35,451 --> 00:01:38,387 and redeploy the page all the time. 31 00:01:38,387 --> 00:01:43,170 And that doesn't sound like a great thing to do. 32 00:01:43,170 --> 00:01:46,911 Well, Next.js also has solutions for this. 33 00:01:46,911 --> 00:01:51,376 Solution number one is that you do pre-build your page, 34 00:01:51,376 --> 00:01:55,460 but then you still include standard react code 35 00:01:55,460 --> 00:01:58,886 in your react components, where you use, use effect 36 00:01:58,886 --> 00:02:03,380 for then fetching updated data from a server. 37 00:02:03,380 --> 00:02:06,130 So you would always serve back a page 38 00:02:06,130 --> 00:02:08,648 with some pre-rendered data, 39 00:02:08,648 --> 00:02:11,410 but that data might be outdated. 40 00:02:11,410 --> 00:02:14,190 So you fetched a latest data in the background 41 00:02:14,190 --> 00:02:19,190 and then update the loaded page after that data arrived. 42 00:02:19,420 --> 00:02:21,950 That's a pattern you could implement. 43 00:02:21,950 --> 00:02:25,430 Then you at least chose something to your users, 44 00:02:25,430 --> 00:02:27,580 but it might be a bit outdated, 45 00:02:27,580 --> 00:02:29,938 but that's why you're fetching data in the background, 46 00:02:29,938 --> 00:02:32,300 so that you can update the page 47 00:02:32,300 --> 00:02:35,280 with the latest data once you got that. 48 00:02:35,280 --> 00:02:38,700 That might be a perfectly valid pattern, 49 00:02:38,700 --> 00:02:42,240 but there is an alternative which often is better. 50 00:02:42,240 --> 00:02:46,514 This get static props function, as I mentioned does execute 51 00:02:46,514 --> 00:02:50,380 when you build your project with next build, 52 00:02:50,380 --> 00:02:52,650 so with this build script. 53 00:02:52,650 --> 00:02:54,620 Well, that's not entirely true. 54 00:02:54,620 --> 00:02:58,075 It does execute there, but that is not necessarily 55 00:02:58,075 --> 00:03:01,300 the only time it executes. 56 00:03:01,300 --> 00:03:04,200 Instead, Next.js has a built in feature, 57 00:03:04,200 --> 00:03:09,140 which is called incremental static generation. 58 00:03:09,140 --> 00:03:11,370 It means that you don't just generate 59 00:03:11,370 --> 00:03:14,750 your page statically once at build time, 60 00:03:14,750 --> 00:03:17,150 but that it's continuously updated 61 00:03:17,150 --> 00:03:22,150 even after deployment without you re-deploying it. 62 00:03:22,370 --> 00:03:25,630 So you pre-generate a page, but then you can also 63 00:03:25,630 --> 00:03:29,405 tell Next.js that a given page should be re-generated again 64 00:03:29,405 --> 00:03:34,405 for every incoming request at most every X seconds. 65 00:03:35,950 --> 00:03:38,520 So every 60 seconds, for example. 66 00:03:38,520 --> 00:03:41,195 That means that if a request is made 67 00:03:41,195 --> 00:03:46,195 for a certain page and it's, let's say less than 60 seconds 68 00:03:46,830 --> 00:03:50,410 since it was last re-generated, the existing page 69 00:03:50,410 --> 00:03:52,460 would be served to the visitor. 70 00:03:52,460 --> 00:03:55,136 But if it's past those 60 seconds 71 00:03:55,136 --> 00:03:58,350 and the amount of seconds of course is up to you, 72 00:03:58,350 --> 00:04:02,730 then this page would be pre-generated on the server instead. 73 00:04:02,730 --> 00:04:05,820 So that means that you either serve the old page 74 00:04:05,820 --> 00:04:09,868 if it's not that old yet, or you serve the latest page 75 00:04:09,868 --> 00:04:13,285 and brand new page, which was generated again 76 00:04:13,285 --> 00:04:16,000 on the server otherwise. 77 00:04:16,000 --> 00:04:19,450 And if that page was pre-generated again 78 00:04:19,450 --> 00:04:22,029 on the server, because it was outdated, 79 00:04:22,029 --> 00:04:24,167 then this newly generated page 80 00:04:24,167 --> 00:04:28,157 will replace the existing old page on the server. 81 00:04:28,157 --> 00:04:31,055 It will be cashed and future visitors 82 00:04:31,055 --> 00:04:35,290 will see that re-generated page instead. 83 00:04:35,290 --> 00:04:37,260 Until 60 seconds passed again, 84 00:04:37,260 --> 00:04:40,380 and then new page is pre-generated again. 85 00:04:40,380 --> 00:04:44,311 So you can have ongoing pre-rendering on the server 86 00:04:44,311 --> 00:04:47,750 for incoming requests. 87 00:04:47,750 --> 00:04:52,680 And all you need to do to unlock this is in the object, 88 00:04:52,680 --> 00:04:55,130 which you return in get static props. 89 00:04:55,130 --> 00:04:57,223 You don't just return props, 90 00:04:57,223 --> 00:05:01,873 but you also add a second key, which is called revalidate. 91 00:05:02,830 --> 00:05:05,810 And as a value, you set a number a year, 92 00:05:05,810 --> 00:05:09,101 which is the time in seconds that Next.js 93 00:05:09,101 --> 00:05:13,270 should wait until it re-generates this page. 94 00:05:13,270 --> 00:05:17,610 So for example, if I enter 10 here, we would tell Next.js 95 00:05:17,610 --> 00:05:20,440 that for every incoming request to this page, 96 00:05:20,440 --> 00:05:23,940 it should be re-generated unless, 97 00:05:23,940 --> 00:05:28,940 it's less than 10 seconds ago that it was last re-generated. 98 00:05:29,140 --> 00:05:33,266 So it's recreated at most once every 10 seconds. 99 00:05:33,266 --> 00:05:36,530 And of course the higher this number is, 100 00:05:36,530 --> 00:05:39,360 the less this page will be re-generated. 101 00:05:39,360 --> 00:05:42,650 And it's totally up to you which value you want here. 102 00:05:42,650 --> 00:05:45,082 It will of course depend on which kind of application 103 00:05:45,082 --> 00:05:47,180 you're building. 104 00:05:47,180 --> 00:05:50,635 For a highly dynamic page where content changes 105 00:05:50,635 --> 00:05:53,439 all the time, you want a very low value, 106 00:05:53,439 --> 00:05:56,110 maybe just one second. 107 00:05:56,110 --> 00:05:59,483 For pages where the content is less dynamic, 108 00:05:59,483 --> 00:06:02,950 maybe 10 minutes is enough. 109 00:06:02,950 --> 00:06:05,973 So that is then really something you have to decide. 110 00:06:06,820 --> 00:06:10,760 Now during development, the page will be re-generated 111 00:06:10,760 --> 00:06:14,270 for every request, no matter what you enter here. 112 00:06:14,270 --> 00:06:17,327 So with the development server, we will always see 113 00:06:17,327 --> 00:06:19,861 the latest page with the latest data, 114 00:06:19,861 --> 00:06:22,420 and this will always run again. 115 00:06:22,420 --> 00:06:25,460 But in production this number will matter. 116 00:06:25,460 --> 00:06:30,460 So here, if I add, re-generating here in a console log, 117 00:06:35,140 --> 00:06:39,420 instead of get static props, if I now rerun 118 00:06:39,420 --> 00:06:44,230 the development server, we will see here in this terminal, 119 00:06:44,230 --> 00:06:47,530 since that is server side terminal, so to say, 120 00:06:47,530 --> 00:06:51,400 we see re-generating, because I started the Def server. 121 00:06:51,400 --> 00:06:53,890 So that's equivalent to the build process. 122 00:06:53,890 --> 00:06:56,630 It was now pre-generated. 123 00:06:56,630 --> 00:06:59,650 But if I now visit this page by reloading, for example 124 00:06:59,650 --> 00:07:02,286 we see this again, because as I just said, 125 00:07:02,286 --> 00:07:06,500 during development, the revalidate number doesn't matter. 126 00:07:06,500 --> 00:07:08,870 It will re-generate it every time. 127 00:07:08,870 --> 00:07:10,540 In production it will matter, 128 00:07:10,540 --> 00:07:13,280 and then you have the best of both worlds. 129 00:07:13,280 --> 00:07:15,210 You have a pre-rendered page, 130 00:07:15,210 --> 00:07:18,195 which then still is updated after deployment, 131 00:07:18,195 --> 00:07:20,773 just as defined by you. 10667

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