シャドーイング練習: 71k - 動画で英語スピーキングを学ぶ

読み込み中...
1
React is a JavaScript library full of fancy terms like reconciliation, composition, and error boundaries.
2
But what do all these terms actually mean?
3
Let's start from the beginning with components.
4
Components are the building blocks of every React app.
5
They allow us to make all the visible parts of our applications, like buttons, inputs, or even entire pages.
6
Just like Legos, you can use components as many times as you want.
7
Every React component is a JavaScript function that returns markup.
8
But since React is a JavaScript library, React components don't return HTML markup.
9
They actually return something called JSX, which is JavaScript in disguise.
10
JSX is optional, but the alternative way to make user interfaces is with the function createElement, which gets annoying to write pretty fast.
11
So everyone just uses JSX.
12
Since JSX is JavaScript, you can't write attributes like you would in HTML.
13
You have to write them in the camel case style.
14
That means HTML attributes like class become class name.
15
Unlike HTML, which is static and unchanging, the benefit of using React is that you can use dynamic JavaScript values in your JSX.
16
If you have data, you can display it in your JSX using curly braces.
17
Curly braces accept values like strings and numbers directly.
18
You can use them to make your attributes dynamic.
19
And you can style React elements using a JavaScript object within the curly braces.
20
Since JavaScript functions can only return one thing, in React you can only return one parent element from a component.
21
So you can't do this without getting a big error.
22
We could fix this by wrapping these components in a div, but maybe you don't want to add another element to the page.
23
Instead, you can use an empty component called a React fragment.
24
Okay, but what if I want to pass data into another component?
25
For that, you use something called props.
26
To make a prop, create a name on the component you want to pass data to
27
and set it equal to some value.
28
And that's it.
29
You can then use that prop in the component you passed it to.
30
Props refers to properties on an object, which is what you get in the parameters of each component.
31
To use the prop, take it from the object like a normal JavaScript property.
32
Think of them like custom attributes you can add to any component.
33
So wait, can you pass anything as a prop?
34
Yes, you can.
35
You can even pass other components as props using the children prop.
36
If you make opening and closing tags for a component, you can pass other components in between them.
37
These past components are called children, and you can access them on the children prop of the parent component.
38
And it's great for something called composition, which is about organizing our React components in the most optimal way.
39
The children prop is really useful for creating layout components when you want your children to have the same common layout.
40
The key prop is another built -in prop to React.
41
And no, unlike the name implies, it doesn't unlock anything interesting.
42
The key prop is used so React can tell one component apart from another, usually when you're creating a list with the map function.
43
A key is just a unique string or number to identify a component.
44
You'll usually know when you need to add a key because React will warn you in the console.
45
Fortunately, if you don't have a unique value for each item, you can always use the current index from the map function.
46
But how does React take all my amazing code and make it display something in the browser?
47
That process is called rendering.
48
React does this for us, but it's important to know how it works, because sometimes we can do a bad thing and cause it to infinitely re -render,
49
which crashes our app.
50
The way React knows how and when to render our application is using something called the virtual DOM, also known as the VDOM.
51
Okay, but what does DOM mean?
52
DOM stands for Document Object Model, which is what every browser uses to model all the HTML elements on a web page.
53
And when you draw it out, it kind of looks like a tree.
54
Here's the complete rendering process in React.
55
If the state of our React app changes, then React updates the virtual DOM, which is quicker to update than the real DOM.
56
Then, React uses a process called "diffing" to compare the updated virtual DOM to a previous version to see what's changed.
57
Once it sees what's different, React uses a process called "reconciliation" to update the real DOM with the changes that it found.
58
Whenever someone uses our app, tons of events take place like clicks, mouse movements, and key presses, many of which we need to detect.
59
Event handling is how we take those user events and do something with them.
60
React has a lot of built -in events such as OnClick, OnChange, and OnSubmit.
61
These three events are ones you'll probably use the most.
62
If we want to alert users when a button is clicked, we would add the onClick prop to the button and connect it to a function that would show that alert.
63
To manage data in our React apps, we need to use state, not that kind of state though.
64
State is like a snapshot from a camera.
65
It's a picture of our app at any given time.
66
To manage state, we also can't use JavaScript variables.
67
They don't cause our app to re -render.
68
Instead, we use special functions like useState and useReducer.
69
useState takes an argument that serves as the starting value of the state variable, which is likes in this example,
70
and returns an array containing the state variable and a function to update that state.
71
Using our button example, we could also update the number of times the button's been clicked with the update function,
72
setClicks, and display it in the button with the state variable likes.
73
Controlled components use state values to have more predictable behavior.
74
Here's an example of a controlled component where the value typed into the input is being put into state
75
and controlled by the state variable value.
76
Here's how it works.
77
The user types and set value puts what the user typed into state.
78
The state value is then updated and finally, the input uses that updated state as its value.
79
Controlled components are a great pattern to use because if we want to change the component's behavior, we just need to change the state that controls it.
80
UseState is an example of a React hook, which allow us to hook into features such as state within function components.
81
There are five main types of hooks.
82
State hooks like useState and useReducer help you manage state within React components.
83
Context hooks such as useContext let you use data pass through React context Ref hooks,
84
such as useref, let you reference things like HTML elements, Effect hooks, like UseEffect, let you connect with external systems like browser APIs,
85
and performance hooks like Use Memo and Use Callback, which can improve performance by preventing unnecessary work.
86
You'll use all of these hooks at some point, but the majority of the time you'll likely use just three hooks in your React components: useState, useEffect, and use ref.
87
When you think of the word purity, you might think of something like purified water.
88
Purity is a term used to describe how React components should work.
89
But this type of purity is more like how mathematical formulas are pure.
90
Pure React components mean that the same input should always return the same output.
91
To keep a React component pure, they should only return their JSX and not change any objects or variables that existed before rendering.
92
The cup component in this example is impure because it changes the variable count during render, which exists outside the component.
93
This leads to JSX having the wrong output when it is used more than once.
94
To help make sure we don't run into errors like this, we can use something called strict mode.
95
Strict mode is a special component which tells us about mistakes as we develop our React apps.
96
It's really convenient because it's just a component.
97
We usually wrap around our app component and it'll tell us when we really shouldn't do something.
98
But what if we need to do something outside our React app?
99
Your app might need to talk with the browser API, or make a request to a server.
100
If you do have an external system, you're going to need a way to step outside of React.
101
Effects are code that reach outside of our React application.
102
Usually effects, also known as side effects, can be done within event handlers.
103
For example, to make an HTTP request when you submit a form or click on a button.
104
If you can't run your effects within an event handler, then you can run them using the Use Effect hook.
105
For example, a common pattern is to fetch data when components first load with the useEffect hook.
106
Like effects, sometimes you want to step outside React and work directly with the DOM.
107
To reference an actual DOM element, you can use what's called a ref.
108
You can create a ref with the useRef hook, and to get access to a DOM element, use the ref prop on any React element.
109
For some tasks such as focusing an input, it's much easier to reference the actual DOM element instead of attempting to do it the React way.
110
Context is a powerful way to pass prop data through your app's components.
111
Most React apps have tons of nested components.
112
To get data down multiple levels involves passing the same props through components that don't actually need it.
113
Context lets us jump through the component tree and use data at any level without making props.
114
To use context, you first create context and apparent component, then wrap your parent component in a special context component called a context provider.
115
Put the data you want to pass down on the provider, And finally, access that data in any child component with the Use Context hook.
116
Portals, on the other hand, are kind of like context but for components.
117
Portals let you move React components into any HTML element you select.
118
Portals are great for components that can't be displayed properly because of their parents' component styles.
119
for example, for displaying modals, drop -down menus, and tooltips.
120
To create a portal, just use the Create Portal function pass your component to it, and choose the HTML element where you'd like your React component to appear.
121
Suspense is a special component that helps you handle loading a component or its data.
122
Suspense is helpful for components that take some time to fetch data.
123
It provides a better user experience to show a fallback component, like a loading spinner, until the data is available instead of nothing.
124
Suspense is also useful if you're lazily loading a component, which lets us load a component only when it's needed.
125
Since React apps are all JavaScript, errors that happen during rendering can totally break your app.
126
Error boundaries are components that let you catch app -breaking errors
127
and show a fallback component to tell the user about what happened.
128
For example, our app will crash if we run this code because it throws an error when there's no user.
129
To prevent our app from crashing, we'll first add an error boundary to display a fallback component, with a more helpful error message to be displayed to the user.
130
Now if you really want to dive deep into React, I've put together a complete bootcamp to help you master every one of these concepts from front to back.
131
You can get started now at reactbootcamp .dev.
132
I hope you learned a lot in this video, and I'll see you in the next one.

このレッスンについて

今回のレッスンでは、Reactに関する基本的な概念を学びます。具体的には、コンポーネント、JSX、props、キー、レンダリング、仮想DOMなどの重要な用語とその意味について理解を深めます。これらの知識は、プログラミングの基礎を学ぶ際に役立つだけでなく、技術的な英語に慣れるための良い練習にもなります。

重要な語彙とフレーズ

  • コンポーネント - Reactアプリの基礎要素。
  • JSX - JavaScriptで書かれたマークアップ言語。
  • props - コンポーネントにデータを渡すためのプロパティ。
  • レンダリング - コードをブラウザに表示するプロセス。
  • 仮想DOM (VDOM) - Reactが用いる効率的なDOM管理手法。
  • キー - リスト内のコンポーネントを識別するためのユニークな属性。
  • 子コンポーネント - 親コンポーネントの間に配置されたコンポーネント。
  • 構成 - コンポーネントを最適に配置する方法。

練習のコツ

このビデオの内容を効果的に練習するためには、shadow speechを活用することをお勧めします。速度は中程度で、専門用語も多いですが、内容が明確なので、繰り返し聞くことで理解が深まります。最初は、重要な語彙やフレーズをリピートすることから始めましょう。特に、英語の発音を良くするためには、口の動きを意識しながら練習することが重要です。特定のフレーズが速く生成されるタイミングでそれに合わせて声に出してみましょう。繰り返し行うことで、自分の中で自然なリズムが生まれ、より流暢に話せるようになります。

さらに、shadowing siteを利用することで、他の学習者と一緒に効果的な練習ができる環境を整えることができます。特に、IELTS スピーキング対策にも役立ちますので、ぜひ積極的に取り入れてみてください。shadowspeakのコンセプトを取り入れ、自分の発音を記録して振り返ることで、さらなる改善が期待できるでしょう。

シャドーイングとは?英語上達に効果的な理由

シャドーイング(Shadowing)は、もともとプロの通訳者養成プログラムで開発された言語学習法で、多言語習得者として知られるDr. Alexander Arguelles によって広く普及されました。方法はシンプルですが非常に効果的:ネイティブスピーカーの英語を聞きながら、1〜2秒の遅延で声に出してすぐに繰り返す——まるで「影(shadow)」のように話者を追いかけます。文法ドリルや受動的なリスニングと異なり、シャドーイングは脳と口の筋肉が同時にリアルタイムで英語を処理・再現することを強制します。研究により、発音精度、抑揚、リズム、連音、リスニング力、そして会話の流暢さが大幅に向上することが確認されています。IELTSスピーキング対策や自然な英語コミュニケーションを目指す方に特におすすめです。