Skip to content

Commit 83846c7

Browse files
LucaBlackDragondeblasis
authored andcommitted
Transtation of the Introducing jsx page (#14)
* [WIP] Transtation of the `Tutorial` page * Translated first part of page * Finishing translation of Introducing JSX page * Update content/docs/introducing-jsx.md Co-Authored-By: LucaBlackDragon <[email protected]> * Update content/docs/introducing-jsx.md Co-Authored-By: LucaBlackDragon <[email protected]> * Update content/docs/introducing-jsx.md Co-Authored-By: LucaBlackDragon <[email protected]>
1 parent 72c9042 commit 83846c7

File tree

2 files changed

+46
-46
lines changed

2 files changed

+46
-46
lines changed

content/docs/introducing-jsx.md

+45-45
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
11
---
22
id: introducing-jsx
3-
title: Introducing JSX
3+
title: Introduzione a JSX
44
permalink: docs/introducing-jsx.html
55
prev: hello-world.html
66
next: rendering-elements.html
77
---
88

9-
Consider this variable declaration:
9+
Considera questa dichiarazione di variabile:
1010

1111
```js
1212
const element = <h1>Hello, world!</h1>;
1313
```
1414

15-
This funny tag syntax is neither a string nor HTML.
15+
Questa strana sintassi con i tag non è né una stringa né HTML.
1616

17-
It is called JSX, and it is a syntax extension to JavaScript. We recommend using it with React to describe what the UI should look like. JSX may remind you of a template language, but it comes with the full power of JavaScript.
17+
È chiamata JSX, ed è un'estensione della sintassi JavaScript. Ti raccomandiamo di utilizzarla con React per descrivere l'aspetto che dovrebbe avere la UI (*User Interface*, o interfaccia utente). JSX ti potrebbe ricordare un linguaggio di template, ma usufruisce di tutta la potenza del JavaScript.
1818

19-
JSX produces React "elements". We will explore rendering them to the DOM in the [next section](/docs/rendering-elements.html). Below, you can find the basics of JSX necessary to get you started.
19+
JSX produce "elementi React". Studieremo il modo in cui gli elementi vengono renderizzati nel DOM nella [prossima sezione](/docs/rendering-elements.html). Qui sotto troverai le nozioni fondamentali di JSX, sufficienti per iniziare ad utilizzarlo.
2020

21-
### Why JSX? {#why-jsx}
21+
### Perché JSX? {#why-jsx}
2222

23-
React embraces the fact that rendering logic is inherently coupled with other UI logic: how events are handled, how the state changes over time, and how the data is prepared for display.
23+
React riconosce il fatto che la logica di renderizzazione è per sua stessa natura accoppiata con le altre logiche che governano la UI: la gestione degli eventi, il cambiamento dello stato nel tempo, la preparazione dei dati per la visualizzazione.
2424

25-
Instead of artificially separating *technologies* by putting markup and logic in separate files, React [separates *concerns*](https://en.wikipedia.org/wiki/Separation_of_concerns) with loosely coupled units called "components" that contain both. We will come back to components in a [further section](/docs/components-and-props.html), but if you're not yet comfortable putting markup in JS, [this talk](https://www.youtube.com/watch?v=x7cQ3mrcKaY) might convince you otherwise.
25+
Invece di separare artificialmente le *tecnologie* inserendo il codice di markup e la logica in file separati, React [separa le *responsabilità*](https://it.wikipedia.org/wiki/Principio_di_singola_responsabilit%C3%A0) utilizzando unità debolmente accoppiate chiamate "componenti" che contengono entrambi. Torneremo a parlare dei componenti in una [sezione successiva](/docs/components-and-props.html). Se non ti senti ancora a tuo agio ad inserire codice di markup nel JavaScript, [questa presentazione](https://www.youtube.com/watch?v=x7cQ3mrcKaY) dovrebbe riuscire a convincerti.
2626

27-
React [doesn't require](/docs/react-without-jsx.html) using JSX, but most people find it helpful as a visual aid when working with UI inside the JavaScript code. It also allows React to show more useful error and warning messages.
27+
React [non obbliga](/docs/react-without-jsx.html) ad utilizzare JSX, ma la maggior parte delle persone lo trovano utile come aiuto visuale quando lavorano con la UI all'interno del codice JavaScript. Inoltre, JSX consente a React di mostrare messaggi di errore e di avvertimento più efficaci.
2828

29-
With that out of the way, let's get started!
29+
Detto questo, incominciamo!
3030

31-
### Embedding Expressions in JSX {#embedding-expressions-in-jsx}
31+
### Incorporare espressioni in JSX {#embedding-expressions-in-jsx}
3232

33-
In the example below, we declare a variable called `name` and then use it inside JSX by wrapping it in curly braces:
33+
Nell'esempio in basso, dichiariamo una variabile chiamata `name` e poi la utilizziamo all'interno di JSX racchiudendola in parentesi graffe:
3434

3535
```js{1,2}
36-
const name = 'Josh Perez';
36+
const name = 'Giuseppe Verdi';
3737
const element = <h1>Hello, {name}</h1>;
3838
3939
ReactDOM.render(
@@ -42,18 +42,18 @@ ReactDOM.render(
4242
);
4343
```
4444

45-
You can put any valid [JavaScript expression](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators#Expressions) inside the curly braces in JSX. For example, `2 + 2`, `user.firstName`, or `formatName(user)` are all valid JavaScript expressions.
45+
Puoi inserire qualsiasi [espressione JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators#Expressions) all'interno delle parentesi graffe in JSX. Ad esempio, `2 + 2`, `user.firstName` o `formatName(user)` sono tutte espressioni JavaScript valide.
4646

47-
In the example below, we embed the result of calling a JavaScript function, `formatName(user)`, into an `<h1>` element.
47+
Nell'esempio in basso, includiamo il risultato della chiamata ad una funzione JavaScript, `formatName(user)`, in un elemento `<h1>`.
4848

4949
```js{12}
5050
function formatName(user) {
5151
return user.firstName + ' ' + user.lastName;
5252
}
5353
5454
const user = {
55-
firstName: 'Harper',
56-
lastName: 'Perez'
55+
firstName: 'Giuseppe',
56+
lastName: 'Verdi'
5757
};
5858
5959
const element = (
@@ -70,13 +70,13 @@ ReactDOM.render(
7070

7171
[](codepen://introducing-jsx)
7272

73-
We split JSX over multiple lines for readability. While it isn't required, when doing this, we also recommend wrapping it in parentheses to avoid the pitfalls of [automatic semicolon insertion](http://stackoverflow.com/q/2846283).
73+
Abbiamo suddiviso il codice JSX su più linee per renderlo più leggibile. Sebbene non sia obbligatorio, se segui questa pratica ti consigliamo di racchiudere il codice in parentesi per evitare i problemi che possono derivare dall'[inserimento automatico dei punto e virgola](http://stackoverflow.com/q/2846283).
7474

75-
### JSX is an Expression Too {#jsx-is-an-expression-too}
75+
### JSX è un'Espressione {#jsx-is-an-expression-too}
7676

77-
After compilation, JSX expressions become regular JavaScript function calls and evaluate to JavaScript objects.
77+
Dopo la compilazione, le espressioni JSX diventano normali chiamate a funzioni JavaScript che producono oggetti JavaScript.
7878

79-
This means that you can use JSX inside of `if` statements and `for` loops, assign it to variables, accept it as arguments, and return it from functions:
79+
Questo significa che puoi utilizzare JSX all'interno di istruzioni `if` e cicli `for`, assegnarlo a variabili, utilizzarlo come argomento di una funzione e restituirlo come risultato di una funzione:
8080

8181
```js{3,5}
8282
function getGreeting(user) {
@@ -87,37 +87,37 @@ function getGreeting(user) {
8787
}
8888
```
8989

90-
### Specifying Attributes with JSX {#specifying-attributes-with-jsx}
90+
### Specificare gli Attributi con JSX {#specifying-attributes-with-jsx}
9191

92-
You may use quotes to specify string literals as attributes:
92+
Puoi utilizzare le virgolette per valorizzare gli attributi con una stringa:
9393

9494
```js
9595
const element = <div tabIndex="0"></div>;
9696
```
9797

98-
You may also use curly braces to embed a JavaScript expression in an attribute:
98+
Puoi anche utilizzare le parentesi graffe per includere un'espressione JavaScript in un attributo:
9999

100100
```js
101101
const element = <img src={user.avatarUrl}></img>;
102102
```
103103

104-
Don't put quotes around curly braces when embedding a JavaScript expression in an attribute. You should either use quotes (for string values) or curly braces (for expressions), but not both in the same attribute.
104+
Non aggiungere le virgolette attorno alle parentesi graffe quando includi un'espressione JavaScript in un attributo. Dovresti utilizzare o le virgolette (per le stringhe) o le parentesi graffe (per le espressioni), ma mai entrambe nello stesso attributo.
105105

106-
>**Warning:**
106+
>**Attenzione:**
107107
>
108-
>Since JSX is closer to JavaScript than to HTML, React DOM uses `camelCase` property naming convention instead of HTML attribute names.
108+
>Dal momento che JSX è più vicino al JavaScript che all'HTML, React DOM utilizza la convenzione [`camelCase`](https://it.wikipedia.org/wiki/Notazione_a_cammello) nell'assegnare il nome agli attributi, invece che quella utilizzata normalmente nell'HTML, e modifica il nome di alcuni attributi.
109109
>
110-
>For example, `class` becomes [`className`](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) in JSX, and `tabindex` becomes [`tabIndex`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/tabIndex).
110+
>Ad esempio, `class` diventa [`className`](https://developer.mozilla.org/it/docs/Web/API/Element/className) in JSX e `tabindex` diventa [`tabIndex`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/tabIndex).
111111
112-
### Specifying Children with JSX {#specifying-children-with-jsx}
112+
### Specificare Figli in JSX {#specifying-children-with-jsx}
113113

114-
If a tag is empty, you may close it immediately with `/>`, like XML:
114+
Se un tag è vuoto, puoi chiuderlo immediatamente con `/>`, come in XML:
115115

116116
```js
117117
const element = <img src={user.avatarUrl} />;
118118
```
119119

120-
JSX tags may contain children:
120+
I tag JSX possono contenere figli:
121121

122122
```js
123123
const element = (
@@ -128,23 +128,23 @@ const element = (
128128
);
129129
```
130130

131-
### JSX Prevents Injection Attacks {#jsx-prevents-injection-attacks}
131+
### JSX Previene gli Attacchi di Iniezione del Codice {#jsx-prevents-injection-attacks}
132132

133-
It is safe to embed user input in JSX:
133+
Utilizzare l'input degli utenti in JSX è sicuro:
134134

135135
```js
136-
const title = response.potentiallyMaliciousInput;
137-
// This is safe:
136+
const title = response.contenutoPotenzialmentePericoloso;
137+
// Questo è sicuro:
138138
const element = <h1>{title}</h1>;
139139
```
140140

141-
By default, React DOM [escapes](http://stackoverflow.com/questions/7381974/which-characters-need-to-be-escaped-on-html) any values embedded in JSX before rendering them. Thus it ensures that you can never inject anything that's not explicitly written in your application. Everything is converted to a string before being rendered. This helps prevent [XSS (cross-site-scripting)](https://en.wikipedia.org/wiki/Cross-site_scripting) attacks.
141+
React DOM effettua automaticamente l'[escape](http://stackoverflow.com/questions/7381974/which-characters-need-to-be-escaped-on-html) di qualsiasi valore inserito in JSX prima di renderizzarlo. In questo modo, garantisce che non sia possibile iniettare nulla che non sia esplicitamente scritto nella tua applicazione. Ogni cosa è convertita in stringa prima di essere renderizzata. Questo aiuta a prevenire gli attacchi [XSS (cross-site-scripting)](https://it.wikipedia.org/wiki/Cross-site_scripting).
142142

143-
### JSX Represents Objects {#jsx-represents-objects}
143+
### JSX Rappresenta Oggetti {#jsx-represents-objects}
144144

145-
Babel compiles JSX down to `React.createElement()` calls.
145+
Babel compila JSX in chiamate a `React.createElement()`.
146146

147-
These two examples are identical:
147+
Questi due esempi sono identici:
148148

149149
```js
150150
const element = (
@@ -162,10 +162,10 @@ const element = React.createElement(
162162
);
163163
```
164164

165-
`React.createElement()` performs a few checks to help you write bug-free code but essentially it creates an object like this:
165+
`React.createElement()` effettua alcuni controlli per aiutarti a scrivere codice senza bug, ma fondamentalmente crea un oggetto come questo:
166166

167167
```js
168-
// Note: this structure is simplified
168+
// Nota: questa struttura è semplificata
169169
const element = {
170170
type: 'h1',
171171
props: {
@@ -175,10 +175,10 @@ const element = {
175175
};
176176
```
177177

178-
These objects are called "React elements". You can think of them as descriptions of what you want to see on the screen. React reads these objects and uses them to construct the DOM and keep it up to date.
178+
Questi oggetti sono chiamati "elementi React". Puoi pensare a loro come a descrizioni di ciò che vuoi vedere sullo schermo. React legge questi oggetti e li utilizza per costruire il DOM e tenerlo aggiornato.
179179

180-
We will explore rendering React elements to the DOM in the next section.
180+
Esploreremo la renderizzazione degli elementi React nel DOM nella prossima sezione.
181181

182-
>**Tip:**
182+
>**Consiglio:**
183183
>
184-
>We recommend using the ["Babel" language definition](http://babeljs.io/docs/editors) for your editor of choice so that both ES6 and JSX code is properly highlighted. This website uses the [Oceanic Next](https://labs.voronianski.com/oceanic-next-color-scheme/) color scheme which is compatible with it.
184+
>Ti raccomandiamo di [indicare "Babel" come linguaggio](http://babeljs.io/docs/editors) nel tuo editor preferito, in modo che il codice ES6 ed il codice JSX siano entrambi evidenziati correttamente. Questo sito utilizza lo schema di colori compatibile [Oceanic Next](https://labs.voronianski.com/oceanic-next-color-scheme/).

content/docs/nav.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
- id: hello-world
1515
title: Hello World
1616
- id: introducing-jsx
17-
title: Introducing JSX
17+
title: Introduzione a JSX
1818
- id: rendering-elements
1919
title: Renderizzare Elementi
2020
- id: components-and-props

0 commit comments

Comments
 (0)