From 0c06026a8e993a6bc97f465533ad0bc293c33b3f Mon Sep 17 00:00:00 2001 From: "Dennis A. Boanini" Date: Sun, 1 Nov 2020 19:14:29 +0100 Subject: [PATCH 1/5] Translate of JSX in depth chapter --- content/docs/jsx-in-depth.md | 109 ++++++++++++++++++----------------- 1 file changed, 55 insertions(+), 54 deletions(-) diff --git a/content/docs/jsx-in-depth.md b/content/docs/jsx-in-depth.md index 896a6a6e3..6e3a77759 100644 --- a/content/docs/jsx-in-depth.md +++ b/content/docs/jsx-in-depth.md @@ -13,7 +13,8 @@ redirect_from: - "docs/jsx-in-depth-ko-KR.html" --- -Fundamentally, JSX just provides syntactic sugar for the `React.createElement(component, props, ...children)` function. The JSX code: +Fondamentalmente JSX fornisce zucchero sintattico per la scrittura di funzioni della forma `React.createElement(component, props, ...children)`. +Il codice seguente ```js @@ -21,7 +22,7 @@ Fundamentally, JSX just provides syntactic sugar for the `React.createElement(co ``` -compiles into: +una volta compilato viene tradotto in: ```js React.createElement( @@ -31,13 +32,13 @@ React.createElement( ) ``` -You can also use the self-closing form of the tag if there are no children. So: +É anche possibile utilizzare la versione self-closing del tag se, e solo se, non ci sono elementi figli. Quindi ```js
``` -compiles into: +una volta compilato viene tradotto in: ```js React.createElement( @@ -46,19 +47,19 @@ React.createElement( ) ``` -If you want to test out how some specific JSX is converted into JavaScript, you can try out [the online Babel compiler](babel://jsx-simple-example). +Per vedere come il codice JSX viene convertito in JavaScript puoi provare il [compilatore babel online](babel://jsx-simple-example). -## Specifying The React Element Type {#specifying-the-react-element-type} +## Specificare il tipo di elemento React {#specifying-the-react-element-type} -The first part of a JSX tag determines the type of the React element. +La prima parte di un tag JSX indica il tipo di elemento React. -Capitalized types indicate that the JSX tag is referring to a React component. These tags get compiled into a direct reference to the named variable, so if you use the JSX `` expression, `Foo` must be in scope. +I tipi con la prima lettera maiuscola indicano che il tag JSX si riferisce ad un componente React. Una volta eseguita la compilazione questi tag avranno un riferimento diretto con la variabile, il che significa che per usare il tag `` la rispettiva variabile `Foo` deve essere nello stesso scope. -### React Must Be in Scope {#react-must-be-in-scope} +### React deve essere in scope {#react-must-be-in-scope} -Since JSX compiles into calls to `React.createElement`, the `React` library must also always be in scope from your JSX code. +Dal momento che JSX compila in chiamate del tipo `React.createElement`, la libreria `React` deve essere sempre nello stesso scope del codice JSX. -For example, both of the imports are necessary in this code, even though `React` and `CustomButton` are not directly referenced from JavaScript: +Ad esempio in questo pezzo di codice entrambi gli imports sono necessari anche se `React` e `CustomButton` non sono direttamente referenziati all'interno di JavaScript: ```js{1,2,5} import React from 'react'; @@ -70,11 +71,11 @@ function WarningButton() { } ``` -If you don't use a JavaScript bundler and loaded React from a `