Skip to content

Commit a9bc77a

Browse files
Waxer59Vicenciomf1
andauthored
translate fragment (beta docs) (#564)
* translation * added grammatical revision Co-authored-by: Vicente Martínez Fernández <[email protected]>
1 parent eed9bd7 commit a9bc77a

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

beta/src/content/apis/react/Fragment.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
2-
title: Fragment (<>...</>)
2+
title: Fragmento (<>...</>)
33
---
44

55
<Intro>
66

7-
The `Fragment` component, which is often used via the `<>...</>` syntax, lets you render multiple elements in place of one, without wrapping them in any other container element.
7+
El componente `Fragment`, que es se suele utilizar a través de la sintaxis `<>...</>`, te permite renderizar múltiples elementos en lugar de uno, sin tener que envolverlos dentro de otro elemento contenedor.
88

99
```js
1010
<>
@@ -19,11 +19,11 @@ The `Fragment` component, which is often used via the `<>...</>` syntax, lets yo
1919

2020
---
2121

22-
## Usage {/*usage*/}
22+
## Uso {/*usage*/}
2323

24-
### Returning multiple elements {/*returning-multiple-elements*/}
24+
### Retornar múltiples elementos {/*returning-multiple-elements*/}
2525

26-
Use `Fragment`, or the equivalent `<>...</>` syntax, to group multiple elements together. You can use it to put multiple elements in any place where a single element can go. For example, a component can only return one element, but by using a Fragment you can group multiple elements together and then return them as a group:
26+
Usa `Fragment`, o la sintaxis equivalente `<>...</>`, para agrupar múltiples elementos. Puedes usarlo para poner múltiples elementos en cualquier lugar donde un solo elemento puede ir. Por ejemplo, un componente solo puede retornar un elemento, pero usando un Fragmento puedes agrupar múltiples elementos y retornarlos como un grupo:
2727

2828
```js {3,6}
2929
function Post() {
@@ -36,7 +36,7 @@ function Post() {
3636
}
3737
```
3838

39-
Fragments are useful because grouping elements with a Fragment has no effect on layout or styles, unlike if you wrapped the elements in some other container such as a DOM element. If you inspect this example with the browser tools, you'll see that all `<h1>` and `<p>` DOM nodes appear as siblings without wrappers around them:
39+
Los Fragmentos son útiles porque la agrupación de elementos con un Fragmento no tiene efecto en el diseño o los estilos, al contrario de cómo sería si envolvieras los elementos dentro de cualquier otro contenedor tal como un elemento del DOM. Si inspeccionas este ejemplo con las herramientas del navegador, verás que todos los nodos del DOM `<h1>` y `<p>` aparecen como hermanos sin envoltorios alrededor de ellos:
4040

4141
<Sandpack>
4242

@@ -74,9 +74,9 @@ function PostBody({ body }) {
7474

7575
</Sandpack>
7676

77-
<DeepDive title="How to write a Fragment without the special syntax?">
77+
<DeepDive title="¿Como escribir un fragmento sin la sintaxis especial?">
7878

79-
The example above is equivalent to importing `Fragment` from React:
79+
El ejemplo anterior es equivalente a importar `Fragment` de React:
8080

8181
```js {1,5,8}
8282
import { Fragment } from 'react';
@@ -91,15 +91,15 @@ function Post() {
9191
}
9292
```
9393

94-
Usually you won't need this unless you need to [pass a `key` to your `Fragment`.](#rendering-a-list-of-fragments)
94+
Usualmente no necesitarás esto a menos que necesites [pasar una `key` a tu `Fragment`.](#rendering-a-list-of-fragments)
9595

9696
</DeepDive>
9797

9898
---
9999

100-
### Assigning multiple elements to a variable {/*assigning-multiple-elements-to-a-variable*/}
100+
### Asignar múltiples elementos a una variable {/*assigning-multiple-elements-to-a-variable*/}
101101

102-
Like any other element, you can assign Fragment elements to variables, pass them as props, and so on:
102+
Como cualquier otro elemento, puedes asignar Fragmentos a variables, pasarlos como props, y así sucesivamente:
103103

104104
```js
105105
function CloseDialog() {
@@ -119,9 +119,9 @@ function CloseDialog() {
119119
120120
---
121121
122-
### Grouping elements with text {/*grouping-elements-with-text*/}
122+
### Agrupar elementos con texto {/*grouping-elements-with-text*/}
123123
124-
You can use `Fragment` to group text together with components:
124+
Puedes usar `Fragment` para agrupar texto con componentes:
125125
126126
```js
127127
function DateRangePicker({ start, end }) {
@@ -138,9 +138,9 @@ function DateRangePicker({ start, end }) {
138138
139139
---
140140
141-
### Rendering a list of Fragments {/*rendering-a-list-of-fragments*/}
141+
### Renderizar una lista de fragmentos {/*rendering-a-list-of-fragments*/}
142142
143-
Here's a situation where you need to write `Fragment` explicitly instead of using the `<></>` syntax. When you [render multiple elements in a loop](/learn/rendering-lists), you need to assign a `key` to each element. If the elements within the loop are Fragments, you need to use the normal JSX element syntax in order to provide the `key` attribute:
143+
Esta es una situación donde necesitas escribir `Fragment` explicitamente en lugar de usar la sintaxis `<></>`. Cuando [renderizas múltiples elementos dentro de un bucle](/learn/rendering-lists), necesitas asignar una `key` a cada elemento. Si los elementos dentro del bucle son Fragmentos, necesitar usar la sintaxis habitual de un elemento JSX con el fin de proveer el atributo `key`:
144144
145145
```js {3,6}
146146
function Blog() {
@@ -153,7 +153,7 @@ function Blog() {
153153
}
154154
```
155155
156-
You can inspect the DOM to verify that there are no wrapper elements around the Fragment children:
156+
Puedes inspeccionar el DOM para verificar que no hay ningun envoltorio alrededor del Fragmento hijo:
157157
158158
<Sandpack>
159159
@@ -191,20 +191,20 @@ function PostBody({ body }) {
191191
192192
---
193193
194-
## Reference {/*reference*/}
194+
## Referencia {/*reference*/}
195195
196196
### `Fragment` {/*fragment*/}
197197
198-
Wrap elements in `<Fragment>` to group them together in situations where you need a single element. Grouping elements in `Fragment` has no effect on the resulting DOM; it is the same as if the elements were not grouped. The empty JSX tag `<></>` is shorthand for `<Fragment></Fragment>` in most cases.
198+
Envuelve elementos en un `<Fragment>` para agruparlos en situaciones donde necesites un solo elemento. Agrupar elementos en `Fragment` no tiene efecto en el DOM resultante; ya que quedará igual que si los elementos no estuvieran agrupados. La etiqueta JSX vacía `<></>` es la abreviatura de `<Fragment></Fragment>` en la mayoría de los casos.
199199
200200
#### Props {/*fragment-props*/}
201201
202-
- **optional** `key`: Fragments declared with the explicit `<Fragment>` syntax may have [keys.](https://beta.reactjs.org/learn/rendering-lists#keeping-list-items-in-order-with-key)
202+
- **Opcional** `key`: Los Fragmentos declarados con la sintaxis explícita `<Fragment>` pueden tener [llaves.](https://beta.reactjs.org/learn/rendering-lists#keeping-list-items-in-order-with-key)
203203
204-
#### Caveats {/*caveats*/}
204+
#### Advertencias {/*caveats*/}
205205
206-
- If you want to pass `key` to a Fragment, you can't use the `<>...</>` syntax. You have to explicitly import `Fragment` from `'react'` and render `<Fragment key={yourKey}>...</Fragment>`.
206+
- Si quisieras pasarle una `key` a un Fragmento, no podrias usar la sintaxis `<>...</>`. Tendrias que importar explícitamente `Fragment` desde `'react'` y renderizar `<Fragment key={yourKey}>...</Fragment>`.
207207
208-
- React does not [reset state](/learn/preserving-and-resetting-state) when you go from rendering `<><Child /></>` to `[<Child />]` or back, or when you go from rendering `<><Child /></>` to `<Child />` and back. This only works a single level deep: for example, going from `<><><Child /></></>` to `<Child />` resets the state. See the precise semantics [here.](https://gist.github.com/clemmy/b3ef00f9507909429d8aa0d3ee4f986b)
208+
- React no [restablece el estado](/learn/preserving-and-resetting-state) cuando renderizas desde un `<><Child /></>` a un `[<Child />]` y viceversa, o cuando renderizas desde un `<><Child /></>` a un `<Child />` y viceversa. Ten en cuenta de que esto sólo funciona a un nivel de profundidad: por ejemplo, ir desde un `<><><Child /></></>` a un `<Child />` restablece el estado. Échale un ojo a la sintaxis en detalle [aquí.](https://gist.github.com/clemmy/b3ef00f9507909429d8aa0d3ee4f986b)
209209
210210

0 commit comments

Comments
 (0)