Luyện nói tiếng Anh bằng Shadowing qua video: Next.js in 100 Seconds // Plus Full Beginner's Tutorial

Chọn chế độ luyện tập

Mỗi chế độ mở một phòng luyện tập toàn màn hình.

163 câu
Nếu các câu quá ngắn hoặc quá dài, hãy bấm Edit để chỉnh sửa.
1
Next .js, create fast, search engine optimized
2
React apps with zero configuration.
3
A traditional React app is rendered client -side, where the browser starts with a shell of an HTML page lacking any rendered content.
4
From there, the browser fetches the JavaScript file containing the React code to render content to the page and make it interactive.
5
But there are two major drawbacks with client -side rendering.
6
One, the content is not reliably indexed by all search engines or read by social media linkbots.
7
And two, it can take longer to reach the first contentful paint when a user first lands on the web page.
8
Next is a framework that allows you to build a React app, but render the content in advance on the server,
9
so the first thing a user or a search bot sees is the fully rendered HTML.
10
After receiving this initial page, client -side rendering takes over, and it works just like a traditional React app.
11
It's the best of both worlds.
12
Fully rendered content for bots, highly interactive content for users.
13
Inside of a Next project, you have a Pages directory.
14
Each JavaScript file defined here exports a React component that represents a route in the application.
15
In other words, the file structure here mirrors the actual URLs that the user will navigate to,
16
and Next provides its own router to make navigation seamless.
17
But the real magic comes into play when we talk about data fetching, because Next can perform multiple server rendering strategies from a single project.
18
Static generation, or pre -rendering, allows you to render your pages at build time.
19
Each page or component can implement a function called getStaticProps.
20
It might fetch data from a cloud database, then pass the data as props to the component.
21
You can then build your app to render out all the HTML locally
22
and upload it to a storage bucket where it can be easily cached by a CDN.
23
That works great for a blog or any kind of app where the data doesn't change often.
24
But if the data does change often, you can implement server -side rendering, which builds the HTML page each time it's requested by the user.
25
In the component, we implement data fetching with the getServerSideProps function.
26
Instead of running at build time, this function runs at request time.
27
That means the page will fetch the latest data on the server each time a new request comes in.
28
That's great for pages with rapidly changing data, but maybe you want something in between.
29
Yet another option is incremental static regeneration.
30
By simply adding a revalidate option to get static props, Next can regenerate a page whenever a new request comes in within a certain time interval.
31
This has been Next .js in 100 seconds.
32
If you want to see more short videos like this, make sure to subscribe and hit the like button.
33
Then open up VS Code and get ready to go beyond 100 seconds with a full breakdown of Next.
34
Before we get going, I'd like to point out that I'm working on a full
35
React Next Firebase course, which I hope to have finally finished by the end of January, which will be available to Fireship Pro members.
36
My goal over the next few minutes is to teach you the fundamentals of Next
37
while also explaining the complexities of server side rendering.
38
To follow along, open up the terminal and run npx create next app followed by the name of your app.
39
And if you get lost at any point, make sure to grab the source code on GitHub or Fireship IO.
40
Let's open up the project in VS Code and then go into the package .json file.
41
In development, the only script we need to worry about is dev, which you can execute by running npm run dev from the command line,
42
which will run our app on localhost 3000.
43
That should give you the default boilerplate in the browser.
44
Now before we get into the React code, there's a few things that I want to point out.
45
First, in the styles directory here, you'll notice how
46
Next supports CSS modules.
47
In the globals file, you can define styles that apply to the entire application.
48
But in other files with .module, you can define classes that only apply to a specific route or component.
49
And you don't have to worry about coming up with a bunch of unique class names
50
or naming conventions when managing your styles.
51
If you want to use styles from a certain module, you just import the style sheet in your JavaScript,
52
then reference your styles in JSX as if the styles were a JavaScript object.
53
That's pretty awesome, but from there, let's shift our attention over to the pages directory.
54
Inside this directory, we define all of the pages and routes for the application.
55
At the highest level, we have this underscore app .js file, which is like the main entry point into the app.
56
In other words, every individual page will start from this template.
57
Currently, the application only has one page, which points to the root URL and is defined by the component in the index .js file.
58
When a user navigates to this URL, next will find the default export, which is a React component, in this file.
59
So every file or page in your application needs to have one default export.
60
To demonstrate this further, let's create our first route.
61
In the pages directory, create a new file called hello .js.
62
Then we can define the content of this page by exporting
63
a default react component from it from there we can go back to the browser
64
and navigate to localhost 3000 slash hello and we should get the content of
65
that component congratulations you just built your first web page with next
66
but now let's imagine a route that's a little more complex we have a cars route
67
that should show a list of cars then an infinite number of cars
68
that might be dynamically generated under that url we can implement a dynamic route like that by first creating a cars directory.
69
Then inside the directory, we'll add an index .js file.
70
which will show the main list of cars.
71
Then for each individual car, we'll add a component that has a file name of brackets param name dot j s.
72
The brackets make this route dynamic, which means anytime a user navigates to cars slash whatever, or cars slash
73
Tesla, it will render the component in this file.
74
To see that in action, let's go ahead and implement the component logic.
75
In the index file, we'll just add a placeholder for the cars list for now.
76
But in the dynamic component, we'll import the useRouter hook from the next router.
77
It allows us to access the query parameters from the URL.
78
In this example, the value is ID, but you can give it a name of whatever you want.
79
And then we'll render that value out to the template.
80
Now back in the browser, if we go to the cars URL, it renders out the cars component.
81
Then if we add any string after the cars URL, it renders out the dynamic component.
82
Now one other thing you may have noticed in the pages directory is this API directory.
83
So what is that all about?
84
The API directory is a special part of Next for setting up routes that will only apply to the server.
85
That can be useful because the code you write here won't increase the client -side JavaScript bundle
86
that needs to ultimately be sent over the network.
87
We're not going to get into API routes in this video,
88
but just know that it's a useful feature when you have work that needs to be done on the backend,
89
or if you simply want to expose an API for your end users.
90
But now, let's shift our attention over to the most valuable feature in Next, which of course is data fetching.
91
Next allows us to fetch data and render HTML on the server.
92
And again, the benefit of doing that is
93
that the end user gets rendered content quicker
94
and the content can be reliably crawled by search bots and social media link bots.
95
Now, when it comes to server rendering, there are two main options, static generation and server -side rendering.
96
Static generation is also called pre -rendering because you generate all the HTML at build time.
97
It makes life very simple because you generate a bunch of HTML files, then upload them to a storage bucket or static host,
98
and they can be delivered with very high performance over a CDN.
99
But there's a couple of big trade -offs here.
100
The first one is that your data may become stale.
101
If the data on the server changes, you need to rebuild and redeploy your site in order for those changes to be reflected.
102
Another important trade -off to think about is scale.
103
If your website has a million pages, it'll be very slow and difficult to pre -render all of them.
104
That makes static generation most well -suited for data
105
that doesn't change often and for sites that have a relatively low number of total pages.
106
A good example would be a blog, because it might have a few hundred pages and those pages likely don't change on a daily basis.
107
Let's go ahead and take a look at how we might implement static generation in Next.
108
In the car component, let's imagine we need to fetch data from an external source, like a database or API.
109
To simulate that for the demo, I've added a couple of JSON files to the public directory.
110
We have a file that returns an array of IDs, then an individual response for each car,
111
which contains an image and other data about the car.
112
Now we can fetch this data for the car component by implementing the get static props function inside the component file.
113
When you build your site, Next will automatically call this function, then send the result as props to the component itself.
114
What we want to do here is fetch the JSON for an individual car
115
so it can be used in the HTML or UI for the car page.
116
In this case, we need the ID from the URL to know which car was requested.
117
We can get that information from the params argument in the function.
118
Then from there, we'll use the fetch API to make a request to localhost to request the JSON file with that ID.
119
We can then convert it to JSON.
120
Then the final step is to return an object that has a props property, where each prop can then be accessed by the component.
121
Up in the component code, we can destructure the car prop and then use it in the JSX,
122
which I'm doing here by adding an image tag, which relies on the data fetched by the server as the image source.
123
Now if you're concerned about search engine optimization,
124
you likely want to add an SEO -friendly title as well as meta tags to the head of the document.
125
Next makes that very easy to accomplish by simply importing the head component.
126
Anything inside this component will be rendered out to the head of the document.
127
Like in this case, we add a title with the car color and ID.
128
And we could also add meta tags for Twitter and Facebook cards if we wanted to.
129
Now because we're working with a dynamic route, there's one other thing we have to keep in mind.
130
And that's the fact that
131
Next has no way of knowing how many pages we actually have associated to a dynamic route.
132
In order to pre -render all the car IDs, Next needs to know those IDs in advance.
133
And the way we provide that information is by implementing the get static paths function.
134
This function can also request data from an API or database,
135
then its job is to return a paths object that contains an array with every route for this dynamic URL.
136
In this demo, we only have three routes, Tesla, Ford, and Lambo.
137
We map those values to an array of objects, then return them from the function, along with additional options like the fallback behavior.
138
Now if we go visit the app in the browser.
139
we should see a fully rendered web page.
140
It doesn't look any different than a regular React app.
141
However, if you open up the Sources panel in Chrome DevTools, it'll show you the fully rendered HTML before it was touched by JavaScript.
142
Notice how it contains the title and pre -rendered content, which is essential for SEO and sharing content on social media sites.
143
So that's how you implement server -side generation.
144
But another big strategy is server -side rendering.
145
The big difference is that with SSR, the content is generated on a server when requested by the user.
146
This approach is ideal when data changes constantly
147
because it ensures the end user will always get the latest and greatest data from whatever your data source happens to be.
148
However, it's far less efficient because you need to have a server in place to respond to those requests,
149
as opposed to caching everything on a global CDN.
150
Imagine something like an eBay auction where you have millions of listings and those listings are changing all the time.
151
That's probably a good candidate for SSR.
152
In any case, it's very easy to implement a Next.
153
Back in our page file, we'll go ahead and implement another function called getServerSideProps.
154
The only thing that actually changes in our code is the name of the function.
155
We can simply copy the body of the getStaticProps function and paste it into our new function.
156
It does the exact same thing, but does it on every request instead of at build time.
157
Then we can comment out getStaticProps and getStaticPaths because we no longer need those functions.
158
But the real beauty of Next is that we can apply both of these paradigms wherever we want in the application.
159
We're not limited to one or the other.
160
I'm going to go ahead and wrap things up there.
161
If there's anything you want to see in my full
162
Next course, make sure to let me know in the comments.
163
Thanks for watching, and I will see you in the next one.

Tải Ứng Dụng

Mọi thứ bạn cần để nói trôi chảy

Chấm điểm AIChấm từng câu nói
Luyện IPAThành thạo mọi âm
Từ vựngMở rộng vốn từ
Game Từ vựngHọc qua chơi

Cùng kênh

FOR YOU

Video gợi ý

Từ vựng và ghi chú luyện nói cho bài học này

Bài luyện nói này dựa trên video “Next.js in 100 Seconds // Plus Full Beginner's Tutorial”. Những từ được nhắc lại nhiều nhất trong bài: page, component, file, server, route. Video này có 163 câu và 2418 từ để luyện shadowing. Phần lời nói dài 11:49. Người nói nói nhanh, khoảng 205 từ mỗi phút, nên sẽ có nhiều chỗ nối âm và nuốt âm. Chỉ 80% số từ nằm trong 3.000 từ tiếng Anh thông dụng nhất, nên từ vựng khá khó.

Từ vựng quan trọng trong video

15 từ đáng học trong video, kèm phiên âm và nghĩa:

TừPhiên âmNghĩa
component danh từ/kəmˈpoʊ.nənt/bộ phận
server danh từ/ˈsɝvɚ/trình chủ, máy chủ
fetch động từ/fɛt͡ʃ/tìm
implement động từ/ˈɪmpləmənt/thực hiện, chấp hành
default danh từ/dɪˈfɔlt/mặc định
generate động từ/ˈd͡ʒɛn.ə.ɹeɪt/sinh ra, gây ra
database danh từ/ˈdeɪtəˌbeɪs/cơ sở dữ liệu, CSDL
import danh từ/ˈɪm.pɔɹt/nhập khẩu
module danh từ/ˈmɑd͡ʒul/mô-đun, bộ phận rời
bucket danh từ/ˈbʌkɪt/xô
upload động từ/ˈʌpˌloʊd/tải lên
bracket danh từ/ˈbɹækɪt/dấu ngoặc đơn
template danh từ/ˈtɛm.plɪt/bản mẫu, khuôn mẫu
cache danh từ/kæʃ/bộ nhớ đệm, vùng nhớ đệm
mirror danh từ/ˈmiɹɚ/gương, kiếng

Cụm động từ bạn sẽ nghe

TừNghĩa
open up động từmở

Ngữ pháp trong video

Những cấu trúc người nói dùng nhiều nhất, kèm đúng cụm từ trong video:

Cấu trúcTrong video
Câu bị động be + quá khứ phân từ — nhấn vào việc xảy ra, không phải người làmis rendered · is not reliably indexed · can be easily cached
Mệnh đề quan hệ who / which + mệnh đề — thêm thông tin về người hoặc vậtJanuary, which will · file, which is · export, which is
Thì hiện tại hoàn thành have/has + quá khứ phân từ — việc đã xảy ra nhưng còn liên quan đến hiện tạihas been · I've added · have associated

Phát âm cần chú ý

Người nói dùng 25 dạng rút gọn, ví dụ we'll, doesn't, I'm. Hãy nói theo dạng ngắn đúng như bạn nghe.

  • Âm “sh” và “zh”: cache /kæʃ/, efficient /ɪˈfɪʃənt/, congratulations /kənˌɡɹæt͡ʃəˈleɪʃ(ə)nz/, sheet /ʃit/, shell /ʃɛl/
  • Từ dài — đặt trọng âm cho đúng: directory /dɪˈɹɛktəɹi/, interactive /ˌɪn.tɚˈæk.tɪv/, congratulations /kənˌɡɹæt͡ʃəˈleɪʃ(ə)nz/, fundamental /ˌfʌn.dəˈmɛn.təl/, navigation /nævɪˈɡeɪʃən/

Những âm người Việt thường gặp khó:

  • Cụm phụ âm cuối — đọc đủ từng âm, đừng nuốt âm cuối: component /kəmˈpoʊ.nənt/, implement /ˈɪmpləmənt/, react /ɹiːˈækt/, default /dɪˈfɔlt/, export /ˈɛks.pɔɹt/
  • Âm /tʃ/, /dʒ/ và /ʒ/ — tiếng Việt không có, đừng đọc thành “ch” hay “gi”: fetch /fɛt͡ʃ/, generate /ˈd͡ʒɛn.ə.ɹeɪt/, module /ˈmɑd͡ʒul/, package /ˈpæk.ɪd͡ʒ/, congratulations /kənˌɡɹæt͡ʃəˈleɪʃ(ə)nz/
  • Âm /æ/ — mở miệng rộng hơn âm “e”: react /ɹiːˈækt/, static /ˈstæt.ɪk/, dynamic /daɪˈnæm.ɪk/, navigate /ˈnæv.ɪ.ɡeɪt/, tag /tæɡ/

Cách luyện với video này

  1. Nghe hết video một lần, chưa cần nói, và ghi lại những từ bạn chưa biết.
  2. Bắt đầu ở tốc độ 0,75×, nói đuổi từng câu, rồi quay lại tốc độ bình thường khi đã quen.
  3. Ghi âm giọng mình rồi so với bản gốc, chú ý các từ như component, server, fetch.

Phương Pháp Shadowing Là Gì?

Shadowing là kỹ thuật học ngôn ngữ có cơ sở khoa học, ban đầu được phát triển cho chương trình đào tạo phiên dịch viên chuyên nghiệp và được phổ biến rộng rãi bởi nhà đa ngôn ngữ học Dr. Alexander Arguelles. Nguyên lý cốt lõi đơn giản nhưng cực kỳ hiệu quả: bạn nghe tiếng Anh của người bản xứ và lặp lại to ngay lập tức — như một "cái bóng" (shadow) đuổi theo người nói với độ trễ chỉ 1–2 giây. Khác với luyện ngữ pháp hay học từ vựng bị động, Shadowing buộc não bộ và cơ miệng phải đồng thời xử lý và tái tạo ngôn ngữ thực tế. Các nghiên cứu khoa học xác nhận phương pháp này cải thiện đáng kể phát âm, ngữ điệu, nhịp điệu, nối âm, kỹ năng nghe và độ lưu loát khi nói — đặc biệt hiệu quả cho người luyện IELTS Speaking và muốn giao tiếp tiếng Anh tự nhiên như người bản ngữ.

Phương pháp shadowing: đọc hướng dẫn từng bước đầy đủ →