From 82aba7e6e481804bdf0b7e3623d707e281b577f6 Mon Sep 17 00:00:00 2001 From: Oussamaosman02 <109099115+Oussamaosman02@users.noreply.github.com> Date: Mon, 10 Oct 2022 16:55:43 +0200 Subject: [PATCH] Adding rendering-lists translation (#551) --- beta/src/content/learn/rendering-lists.md | 158 +++++++++++----------- 1 file changed, 79 insertions(+), 79 deletions(-) diff --git a/beta/src/content/learn/rendering-lists.md b/beta/src/content/learn/rendering-lists.md index 28dc75ef1..14a492231 100644 --- a/beta/src/content/learn/rendering-lists.md +++ b/beta/src/content/learn/rendering-lists.md @@ -1,24 +1,24 @@ --- -title: Rendering Lists +title: Renderizado de listas --- -You will often want to display multiple similar components from a collection of data. You can use the [JavaScript array methods](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array#) to manipulate an array of data. On this page, you'll use [`filter()`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/filter) and [`map()`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/map) with React to filter and transform your array of data into an array of components. +A menudo querrás mostrar muchos componentes similares de una colección de datos. Puedes usar los [métodos de array de JavaScript](https://developer.mozilla.org/es/docs/Web/JavaScript/Reference/Global_Objects/Array#) para manipular un array de datos. En esta página, usarás [`filter()`](https://developer.mozilla.org/es/docs/Web/JavaScript/Reference/Global_Objects/Array/filter) y [`map()`](https://developer.mozilla.org/es/docs/Web/JavaScript/Reference/Global_Objects/Array/map) con React para filtrar y transformar tu array de datos en un array de componentes. -* How to render components from an array using JavaScript's `map()` -* How to render only specific components using JavaScript's `filter()` -* When and why to use React keys +* Cómo renderizar componentes desde un array usando el método `map()` de JavaScript +* Cómo renderizar solo un componente específico usando `filter()` de JavaScript +* Cuándo y cómo usar las keys de React -## Rendering data from arrays {/*rendering-data-from-arrays*/} +## Renderizar datos desde arrays {/*rendering-data-from-arrays*/} -Say that you have a list of content. +Digamos que tienes una lista de contenido. ```js ``` -The only difference among those list items is their contents, their data. You will often need to show several instances of the same component using different data when building interfaces: from lists of comments to galleries of profile images. In these situations, you can store that data in JavaScript objects and arrays and use methods like [`map()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map) and [`filter()`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/filter) to render lists of components from them. +La única diferencia entre esos elementos de la lista es su contenido, sus datos. A menudo necesitarás mostrar muchas instancias del mismo componente usando diferentes datos cuando construyas interfaces: desde listas de comentarios a galerías de fotos de perfiles. En estas situaciones, puedes guardar estos datos en objetos de JavaScript y arrays, y usar métodos como [`map()`](https://developer.mozilla.org/es/docs/Web/JavaScript/Reference/Global_Objects/Array/map) y [`filter()`](https://developer.mozilla.org/es/docs/Web/JavaScript/Reference/Global_Objects/Array/filter) para renderizar listas de componentes desde ellos. -Here’s a short example of how to generate a list of items from an array: +Aquí hay un corto ejemplo de como generar una lista de elementos de un array: -1. **Move** the data into an array: +1. **Mueve** los datos en un array: ```js const people = [ @@ -46,19 +46,19 @@ const people = [ ]; ``` -2. **Map** the `people` members into a new array of JSX nodes, `listItems`: +2. **Mapea** los miembros de `people` en un nuevo array de nodos JSX, `listItems`: ```js const listItems = people.map(person =>
  • {person}
  • ); ``` -3. **Return** `listItems` from your component wrapped in a `