You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/learn/describing-the-ui.md
+45-46
Original file line number
Diff line number
Diff line change
@@ -1,29 +1,29 @@
1
1
---
2
-
title: Describing the UI
2
+
title: Descrivere la UI
3
3
---
4
4
5
5
<Intro>
6
6
7
-
React is a JavaScript library for rendering user interfaces (UI). UI is built from small units like buttons, text, and images. React lets you combine them into reusable, nestable *components.* From web sites to phone apps, everything on the screen can be broken down into components. In this chapter, you'll learn to create, customize, and conditionally display React components.
7
+
React è una libreria JavaScript per il rendering delle interfacce utente(UI). La UI è costruita da piccole unità come pulsanti, testo e immagini. React ti consente di combinare queste unità in *componenti* riutilizzabili e annidabili. Dalle pagine web alle app per telefoni, tutto sullo schermo può essere scomposto in componenti. In questo capitolo imparerai a creare, personalizzare e visualizzare condizionalmente i componenti React.
8
8
9
9
</Intro>
10
10
11
11
<YouWillLearnisChapter={true}>
12
12
13
-
*[How to write your first React component](/learn/your-first-component)
14
-
*[When and how to create multi-component files](/learn/importing-and-exporting-components)
15
-
*[How to add markup to JavaScript with JSX](/learn/writing-markup-with-jsx)
16
-
*[How to use curly braces with JSX to access JavaScript functionality from your components](/learn/javascript-in-jsx-with-curly-braces)
17
-
*[How to configure components with props](/learn/passing-props-to-a-component)
18
-
*[How to conditionally render components](/learn/conditional-rendering)
19
-
*[How to render multiple components at a time](/learn/rendering-lists)
20
-
*[How to avoid confusing bugs by keeping components pure](/learn/keeping-components-pure)
13
+
*[Come scrivere il tuo primo componente React](/learn/your-first-component)
14
+
*[Quando e come creare file multi-componente](/learn/importing-and-exporting-components)
15
+
*[Come aggiungere markup a JavaScript con JSX](/learn/writing-markup-with-jsx)
16
+
*[Come utilizzare le parentesi graffe con JSX per accedere alla funzionalità JavaScript dai tuoi componenti](/learn/javascript-in-jsx-with-curly-braces)
17
+
*[Come configurare i componenti con props](/learn/passing-props-to-a-component)
18
+
*[Come rappresentare condizionalmente i componenti](/learn/conditional-rendering)
19
+
*[Come renderizzare più componenti contemporaneamente](/learn/rendering-lists)
20
+
*[Come evitare bug confusionari mantenendo i componenti puri](/learn/keeping-components-pure)
21
21
22
22
</YouWillLearn>
23
23
24
-
## Your first component {/*your-first-component*/}
24
+
## Il tuo Primo Componente {/*your-first-component*/}
25
25
26
-
React applications are built from isolated pieces of UI called *components*. A React component is a JavaScript function that you can sprinkle with markup. Components can be as small as a button, or as large as an entire page. Here is a`Gallery`component rendering three `Profile` components:
26
+
Le applicazioni React sono costruite da pezzi isolati di UI chiamati *componenti*. Un componente React è una funzione JavaScript che puoi arricchire con marcatura. I componenti possono essere piccoli come un pulsante o grandi come un'intera pagina. Ecco un componente`Gallery`che renderizza tre componenti `Profile`:
Read**[Your First Component](/learn/your-first-component)**to learn how to declare and use React components.
60
+
Leggi**[Il Tuo Primo Componente](/learn/your-first-component)**per imparare a dichiarare e utilizzare i componenti React.
61
61
62
62
</LearnMore>
63
63
64
-
## Importing and exporting components {/*importing-and-exporting-components*/}
65
-
66
-
You can declare many components in one file, but large files can get difficult to navigate. To solve this, you can *export* a component into its own file, and then *import* that component from another file:
64
+
## Importazione ed Esportazione di Componenti {/*importing-and-exporting-components*/}
67
65
66
+
Puoi dichiarare molti componenti in un unico file, ma i file grandi possono diventare difficili da gestire. Per risolvere questo problema, puoi *esportare* un componente in un file separato e poi importare quel componente da un altro file:
Read**[Importing and Exporting Components](/learn/importing-and-exporting-components)**to learn how to split components into their own files.
114
+
Leggi**[Importazione ed Esportazione di Componenti](/learn/importing-and-exporting-components)**per imparare come suddividere i componenti in file separati.
116
115
117
116
</LearnMore>
118
117
119
-
## Writing markup with JSX {/*writing-markup-with-jsx*/}
118
+
## Scrivere Markup con JSX {/*writing-markup-with-jsx*/}
120
119
121
-
Each React component is a JavaScript function that may contain some markup that React renders into the browser. React components use a syntax extension called JSX to represent that markup. JSX looks a lot like HTML, but it is a bit stricter and can display dynamic information.
120
+
Ogni componente React è una funzione JavaScript che può contenere del markup che React renderizza nel browser. I componenti React utilizzano una estensione di sintassi chiamata JSX per rappresentare questo markup. JSX assomiglia molto all'HTML, ma è un po' più rigoroso e può mostrare informazioni dinamiche.
122
121
123
-
If we paste existing HTML markup into a React component, it won't always work:
122
+
Se copiamo del markup HTML esistente in un componente React, non funzionerà sempre:
124
123
125
124
<Sandpack>
126
125
@@ -149,7 +148,7 @@ img { height: 90px; }
149
148
150
149
</Sandpack>
151
150
152
-
If you have existing HTML like this, you can fix it using a [converter](https://transform.tools/html-to-jsx):
151
+
Se hai HTML esistente come questo, puoi risolverlo usando un [convertitore](https://transform.tools/html-to-jsx):
153
152
154
153
<Sandpack>
155
154
@@ -181,13 +180,13 @@ img { height: 90px; }
181
180
182
181
<LearnMorepath="/learn/writing-markup-with-jsx">
183
182
184
-
Read**[Writing Markup with JSX](/learn/writing-markup-with-jsx)**to learn how to write valid JSX.
183
+
Leggi**[Scrivere Markup con JSX](/learn/writing-markup-with-jsx)**per imparare come scrivere JSX valido.
185
184
186
185
</LearnMore>
187
186
188
-
## JavaScript in JSX with curly braces {/*javascript-in-jsx-with-curly-braces*/}
187
+
## JavaScript in JSX con Parentesi Graffe {/*javascript-in-jsx-with-curly-braces*/}
189
188
190
-
JSX lets you write HTML-like markup inside a JavaScript file, keeping rendering logic and content in the same place. Sometimes you will want to add a little JavaScript logic or reference a dynamic property inside that markup. In this situation, you can use curly braces in your JSX to "open a window" to JavaScript:
189
+
JSX ti consente di scrivere markup simile all'HTML all'interno di un file JavaScript, mantenendo la logica di rendering e il contenuto nello stesso luogo. A volte vorrai aggiungere un po' di logica JavaScript o fare riferimento a una proprietà dinamica all'interno di quel markup. In questa situazione, puoi usare le parentesi graffe nel tuo JSX per "aprire una finestra" su JavaScript:
191
190
192
191
<Sandpack>
193
192
@@ -229,13 +228,13 @@ body > div > div { padding: 20px; }
Read **[JavaScript in JSX with Curly Braces](/learn/javascript-in-jsx-with-curly-braces)** to learn how to access JavaScript data from JSX.
231
+
Leggi **[JavaScript in JSX con Parentesi Graffe](/learn/javascript-in-jsx-with-curly-braces)** per imparare come accedere ai dati JavaScript da JSX.
233
232
234
233
</LearnMore>
235
234
236
-
## Passing props to a component {/*passing-props-to-a-component*/}
235
+
## Passare Prop a un Componente {/*passing-props-to-a-component*/}
237
236
238
-
React components use *props* to communicate with each other. Every parent component can pass some information to its child components by giving them props. Props might remind you of HTML attributes, but you can pass any JavaScript value through them, including objects, arrays, functions, and even JSX!
237
+
I componenti React usano *prop* per comunicare tra loro. Ogni componente padre può passare informazioni ai suoi componenti figlio dandogli delle props. Le props potrebbero farti pensare agli attributi HTML, ma puoi passare qualsiasi valore JavaScript attraverso di esse, inclusi oggetti, array, funzioni e persino JSX!
Your components will often need to display different things depending on different conditions. In React, you can conditionally render JSX using JavaScript syntax like `if` statements, `&&`, and`? :` operators.
318
+
I tuoi componenti spesso dovranno mostrare cose diverse a seconda di diverse condizioni. In React, puoi renderizzare JSX in modo condizionale utilizzando la sintassi JavaScript come gli operatori `if`, `&&` e`? :`.
320
319
321
-
In this example, the JavaScript `&&`operator is used to conditionally render a checkmark:
320
+
In questo esempio, l'operatore `&&`di JavaScript viene utilizzato per renderizzare in modo condizionale un segno di spunta:
322
321
323
322
<Sandpack>
324
323
@@ -358,15 +357,15 @@ export default function PackingList() {
358
357
359
358
<LearnMore path="/learn/conditional-rendering">
360
359
361
-
Read **[Conditional Rendering](/learn/conditional-rendering)** to learn the different ways to render content conditionally.
360
+
Leggi **[Rendering Condizionale](/learn/conditional-rendering)** per imparare i diversi modi per renderizzare contenuti condizionalmente.
362
361
363
362
</LearnMore>
364
363
365
-
## Rendering lists {/*rendering-lists*/}
364
+
## Rendering di Liste {/*rendering-lists*/}
366
365
367
-
You will often want to display multiple similar components from a collection of data. You can use JavaScript's`filter()`and`map()`with React to filter and transform your array of data into an array of components.
366
+
Spesso si desidera visualizzare più componenti simili da una raccolta di dati. È possibile utilizzare i metodi `filter()` e `map()` di JavaScript con React per filtrare e trasformare l'array di dati in un array di componenti.
368
367
369
-
For each array item, you will need to specify a `key`. Usually, you will want to use an IDfrom the database as a `key`. KeysletReact keep track of each item's place in the list even if the list changes.
368
+
Per ogni elemento dell'array, è necessario specificare una `key`. Di solito, si vuole utilizzare un ID dal database come `key`. Le chiavi consentono a React di tenere traccia del posizionamento di ciascun elemento nella lista anche se la lista cambia.
370
369
371
370
<Sandpack>
372
371
@@ -458,18 +457,18 @@ h2 { font-size: 20px; }
458
457
459
458
<LearnMorepath="/learn/rendering-lists">
460
459
461
-
Read**[Rendering Lists](/learn/rendering-lists)**to learn how to render a list of components, and how to choose a key.
460
+
Leggi**[Renderizzare Liste](/learn/rendering-lists)**per imparare come renderizzare una lista di componenti e come scegliere una chiave.
462
461
463
462
</LearnMore>
464
463
465
-
## Keeping components pure {/*keeping-components-pure*/}
464
+
## Mantenere i Componenti Puri {/*keeping-components-pure*/}
466
465
467
-
Some JavaScript functions are *pure.*A pure function:
466
+
Alcune funzioni JavaScript sono *pure.*Una funzione pura:
468
467
469
-
***Minds its own business.**It does not change any objects or variables that existed before it was called.
470
-
***Same inputs, same output.**Given the same inputs, a pure function should always return the same result.
468
+
***Si cura solo dei suoi affari.**Non modifica oggetti o variabili che sono esistiti prima che fosse chiamata.
469
+
***Gli stessi input, lo stesso output.**Dati gli stessi input, una funzione pura dovrebbe sempre restituire lo stesso risultato.
471
470
472
-
By strictly only writing your components as pure functions, you can avoid an entire class of baffling bugs and unpredictable behavior as your codebase grows. Here is an example of an impure component:
471
+
Scrivendo strettamente i tuoi componenti solo come funzioni pure, puoi evitare un'intera classe di errori strani e comportamenti imprevedibili man mano che la tua base di codice cresce. Ecco un esempio di componente non puro:
473
472
474
473
<Sandpack>
475
474
@@ -495,7 +494,7 @@ export default function TeaSet() {
495
494
496
495
</Sandpack>
497
496
498
-
You can make this component pure by passing a prop instead of modifying a preexisting variable:
497
+
Puoi rendere questo componente puro passando una prop invece di modificare una variabile esistente:
499
498
500
499
<Sandpack>
501
500
@@ -519,12 +518,12 @@ export default function TeaSet() {
519
518
520
519
<LearnMorepath="/learn/keeping-components-pure">
521
520
522
-
Read**[Keeping Components Pure](/learn/keeping-components-pure)**to learn how to write components as pure, predictable functions.
521
+
Leggi**[Mantenere i Componenti Puri](/learn/keeping-components-pure)**per imparare a scrivere componenti come funzioni pure e prevedibili.
523
522
524
523
</LearnMore>
525
524
526
-
## What's next? {/*whats-next*/}
525
+
## Qual è il Prossimo Passo? {/*whats-next*/}
527
526
528
-
Head over to [Your First Component](/learn/your-first-component)to start reading this chapter page by page!
527
+
Vai a [Il Tuo Primo Componente](/learn/your-first-component)per iniziare a leggere questa pagina del capitolo pagina per pagina!
529
528
530
-
Or, if you're already familiar with these topics, why not read about [Adding Interactivity](/learn/adding-interactivity)?
529
+
Oppure, se sei già familiare con questi argomenti, perché non leggere su [Aggiungere Interattività](/learn/adding-interactivity)?
0 commit comments