From 8a76149a1394b183fbb9dcc4e9a940319b431a8d Mon Sep 17 00:00:00 2001 From: Windrushfarer Date: Sun, 10 Feb 2019 20:03:00 +0500 Subject: [PATCH 1/4] translation of list and keys --- content/docs/lists-and-keys.md | 76 +++++++++++++++++----------------- content/docs/nav.yml | 2 +- 2 files changed, 39 insertions(+), 39 deletions(-) diff --git a/content/docs/lists-and-keys.md b/content/docs/lists-and-keys.md index c82739a6a..52871fa19 100644 --- a/content/docs/lists-and-keys.md +++ b/content/docs/lists-and-keys.md @@ -1,14 +1,14 @@ --- id: lists-and-keys -title: Lists and Keys +title: Списки и ключи permalink: docs/lists-and-keys.html prev: conditional-rendering.html next: forms.html --- -First, let's review how you transform lists in JavaScript. +Сначала посмотрим как мы работаем со списками в JavaScript. -Given the code below, we use the [`map()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map) function to take an array of `numbers` and double their values. We assign the new array returned by `map()` to the variable `doubled` and log it: +В коде ниже мы используем функцию [`map()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map), чтобы удвоить значения в массиве `numbers`. Мы присваиваем массив, возвращаемый из `map()`, в переменную `doubled` и выводим её в консоль: ```javascript{2} const numbers = [1, 2, 3, 4, 5]; @@ -16,15 +16,15 @@ const doubled = numbers.map((number) => number * 2); console.log(doubled); ``` -This code logs `[2, 4, 6, 8, 10]` to the console. +Этот код выведет `[2, 4, 6, 8, 10]` в консоль. -In React, transforming arrays into lists of [elements](/docs/rendering-elements.html) is nearly identical. +В React преобразование массивов в список [элементов](/docs/rendering-elements.html) выглядит похожим образом. -### Rendering Multiple Components {#rendering-multiple-components} +### Рендер нескольких компонентов {#rendering-multiple-components} -You can build collections of elements and [include them in JSX](/docs/introducing-jsx.html#embedding-expressions-in-jsx) using curly braces `{}`. +Вы можете создавать коллекции элементов и добавлять их в JSX [include them in JSX](/docs/introducing-jsx.html#embedding-expressions-in-jsx) с помощью фигурных скобок `{}`. -Below, we loop through the `numbers` array using the JavaScript [`map()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map) function. We return a `
  • ` element for each item. Finally, we assign the resulting array of elements to `listItems`: +Ниже, мы итерируемся по массиву `numbers`, используя функцию JavaScript [`map()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map), и возвращаем элемент `
  • ` в каждой итерации. В итоге мы присваиваем получившийся массив элементов в `listItems`: ```javascript{2-4} const numbers = [1, 2, 3, 4, 5]; @@ -33,7 +33,7 @@ const listItems = numbers.map((number) => ); ``` -We include the entire `listItems` array inside a `