diff --git a/content/docs/jsx-in-depth.md b/content/docs/jsx-in-depth.md index 3dcf2ac26..beedafca4 100644 --- a/content/docs/jsx-in-depth.md +++ b/content/docs/jsx-in-depth.md @@ -13,31 +13,31 @@ 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: +Fundamentalmente, JSX solo proporciona azúcar sintáctica para la función `React.createElement(component, props, ...children)`. El código JSX: ```js - Click Me + Haz click en mí ``` -compiles into: +se compila en: ```js React.createElement( MyButton, {color: 'blue', shadowSize: 2}, - 'Click Me' + 'Haz click en mí' ) ``` -You can also use the self-closing form of the tag if there are no children. So: +También puedes utilizar la forma de cierre automático de la etiqueta si no hay hijos. Así: ```js
``` -compiles into: +se compila en: ```js React.createElement( @@ -47,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). +Si deseas probar cómo cierto código JSX en específico se convierte a JavaScript, puedes probar [el compilador de Babel en línea](babel://jsx-simple-example). -## Specifying The React Element Type {#specifying-the-react-element-type} +## Especificando el tipo de elemento React {#specifying-the-react-element-type} -The first part of a JSX tag determines the type of the React element. +La primera parte de una etiqueta JSX determina el tipo del 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. +Los tipos en mayúsculas indican que la etiqueta JSX se refiere a un componente React. Estas etiquetas se compilan en una referencia directa a la variable nombrada, por lo que si usas la expresión JSX ``, `Foo` debe estar dentro del alcance. -### React Must Be in Scope {#react-must-be-in-scope} +### React debe estar al alcance {#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. +Como JSX se compila en llamadas a `React.createElement`, la biblioteca` React` también debe estar siempre dentro del alcance de su código JSX. -For example, both of the imports are necessary in this code, even though `React` and `CustomButton` are not directly referenced from JavaScript: +Por ejemplo, ambas importaciones son necesarias en este código, a pesar de que `React` y `CustomButton` no están directamente referenciados desde JavaScript: ```js{1,2,5} import React from 'react'; @@ -71,11 +71,11 @@ function WarningButton() { } ``` -If you don't use a JavaScript bundler and loaded React from a `