Pratica di Shadowing: 71k - Impara a parlare inglese con i video

Caricamento...
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.

Perché fare pratica di conversazione con questo video?

Fare pratica di conversazione in inglese attraverso questo video è un modo efficace per migliorare le tue abilità linguistiche. Il video introduce concetti fondamentali del framework React in un linguaggio semplice e diretto, rendendolo ideale per chi desidera affinare la propria pronuncia e comprensione dell'inglese tecnico. Utilizzando frasi chiare e una spiegazione passo-passo, gli spettatori possono facilmente seguire il discorso, rendendo così più facile il processo di shadowing in inglese, dove si imita il parlato in tempo reale. Questo metodo di apprendimento, noto anche come shadow speaks, è particolarmente utile per acquisire naturalezza e fluidità.

Grammatica ed espressioni nel contesto

Nel video, l'autore utilizza diverse strutture grammaticali che vale la pena analizzare:

  • Present Simple: È frequentemente utilizzato per descrivere i fatti e le procedure, come in "Components are the building blocks of every React app." Questa struttura è essenziale per chi deve esprimere stati e verità generali.
  • Imperative Forms: Espressioni come "Let's start from the beginning" indicano un invito all'azione e sono comuni nel linguaggio colloquiale, perfette per rendere il discorso più coinvolgente.
  • Conditional Sentences: Ad esempio, "What if I want to pass data into another component?" Questa struttura è utile per esprimere possibilità e ipotesi. Praticare queste frasi migliorerà la tua capacità di discutere scenari variabili.
  • Use of Props: Frasi che includono "you can pass anything as a prop" evidenziano la versatilità e l'importanza dei concetti tecnici, rendendo l'argomento accessibile anche a chi è alle prime armi.

Trappole comuni di pronuncia

Durante il video, ci sono alcune parole e frasi che potrebbero risultare difficili da pronunciare per chi sta imparando l'inglese:

  • Components: La pronuncia corretta include un accento sulla seconda sillaba, differente rispetto ad altre parole simili in italiano.
  • JSX: Questo termine tecnico può creare confusione; assicurati di pronunciarlo correttamente per esprimerti con più sicurezza.
  • Rendering: Attento all'accento, in quanto molte persone tendono a pronunciarlo in modo errato, il che può cambiare il significato in contesti diversi.

Utilizzare il video per esercitarti nel shadowing è un ottimo modo per affrontare queste sfide di pronuncia e migliorare la tua capacità di parlare fluentemente e con chiarezza.

Cos'è la tecnica dello Shadowing?

Shadowing è una tecnica di apprendimento delle lingue supportata da studi scientifici, originariamente sviluppata per la formazione dei traduttori professionisti e resa popolare dal poliglotta Dr. Alexander Arguelles. Il metodo è semplice ma potente: ascolti un audio in inglese di madrelingua e lo ripeti immediatamente ad alta voce — come un'ombra che segue il parlante con un ritardo di solo 1–2 secondi. A differenza dell'ascolto passivo o degli esercizi di grammatica, lo shadowing costringe il tuo cervello e i muscoli della bocca a elaborare e riprodurre simultaneamente i modelli di discorso reale. La ricerca dimostra che migliora significativamente la precisione della pronuncia, l'intonazione, il ritmo, il discorso connesso, la comprensione dell'ascolto e la fluidità del parlato — rendendolo uno dei metodi più efficaci per la preparazione alla prova di speaking dell'IELTS e per la comunicazione reale in inglese.