From 7c286e9e3ba1ac847274109bb86bf0a57a66c72f Mon Sep 17 00:00:00 2001 From: aisy Date: Sat, 9 Feb 2019 16:59:01 +0700 Subject: [PATCH 1/8] menerjemahkan konten list & key --- content/docs/lists-and-keys.md | 86 +++++++++++++++++++--------------- 1 file changed, 48 insertions(+), 38 deletions(-) diff --git a/content/docs/lists-and-keys.md b/content/docs/lists-and-keys.md index c82739a6a..e6f23627c 100644 --- a/content/docs/lists-and-keys.md +++ b/content/docs/lists-and-keys.md @@ -1,14 +1,15 @@ --- id: lists-and-keys -title: Lists and Keys +title: Lists dan Key permalink: docs/lists-and-keys.html prev: conditional-rendering.html next: forms.html --- -First, let's review how you transform lists in JavaScript. +Pertama-tama, mari kita tinjau kembali bagaimana anda dapat mentransformasi list di 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: +Jika melihat kode di bawah, kita menggunakan fungsi [`map()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map) untuk mengambil array `numbers` dan menggandakan nilainya. +Kita akan menaruh array baru yang dikembalikan oleh `map()` ke dalam sebuah variabel `doubled` dan me-log-nya: ```javascript{2} const numbers = [1, 2, 3, 4, 5]; @@ -16,15 +17,17 @@ const doubled = numbers.map((number) => number * 2); console.log(doubled); ``` -This code logs `[2, 4, 6, 8, 10]` to the console. +Kode ini akan me-log `[2,4,6,8,10]` ke dalam console. In React, transforming arrays into lists of [elements](/docs/rendering-elements.html) is nearly identical. -### Rendering Multiple Components {#rendering-multiple-components} +### Me-render Banyak Komponen {#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 `{}`. +Anda dapat membangun koleksi beberapa elemen dan [menyertakannya dalam JSX](/docs/introducing-jsx.html#embedding-expressions-in-jsx) menggunakan tanda kurung kurawal `{}`. -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`: +Di bawah ini, kita loop melalui array `numbers` menggunakan fungsi [`map()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map) JavaScript. +Kita akan mengembalikan elemen `
  • ` untuk setiap item. +Akhirnya, kita akan menetapkan array elemen dari hasil proses tersebut ke dalam `listItems`: ```javascript{2-4} const numbers = [1, 2, 3, 4, 5]; @@ -33,7 +36,7 @@ const listItems = numbers.map((number) => ); ``` -We include the entire `listItems` array inside a `