From 0a06734b11533779af506c56b0cf69de70fccea6 Mon Sep 17 00:00:00 2001 From: agallio Date: Mon, 2 Nov 2020 20:15:37 +0700 Subject: [PATCH] Translate all embeded examples of Forwarding Refs docs. --- examples/forwarding-refs/customized-display-name.js | 4 ++-- examples/forwarding-refs/fancy-button-ref.js | 10 +++++----- examples/forwarding-refs/fancy-button-simple-ref.js | 4 ++-- examples/forwarding-refs/fancy-button.js | 4 ++-- examples/forwarding-refs/log-props-after.js | 8 ++++---- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/examples/forwarding-refs/customized-display-name.js b/examples/forwarding-refs/customized-display-name.js index 28bbd9203..5c3632c2b 100644 --- a/examples/forwarding-refs/customized-display-name.js +++ b/examples/forwarding-refs/customized-display-name.js @@ -7,8 +7,8 @@ function logProps(Component) { return ; } - // Give this component a more helpful display name in DevTools. - // e.g. "ForwardRef(logProps(MyComponent))" + // Beri komponen ini nama tampilan yang lebih berguna di DevTools. + // misalnya, "ForwardRef(logProps(MyComponent))" // highlight-range{1-2} const name = Component.displayName || Component.name; forwardRef.displayName = `logProps(${name})`; diff --git a/examples/forwarding-refs/fancy-button-ref.js b/examples/forwarding-refs/fancy-button-ref.js index 36e15dd2d..9899d4839 100644 --- a/examples/forwarding-refs/fancy-button-ref.js +++ b/examples/forwarding-refs/fancy-button-ref.js @@ -3,13 +3,13 @@ import FancyButton from './FancyButton'; // highlight-next-line const ref = React.createRef(); -// The FancyButton component we imported is the LogProps HOC. -// Even though the rendered output will be the same, -// Our ref will point to LogProps instead of the inner FancyButton component! -// This means we can't call e.g. ref.current.focus() +// Komponen FancyButton yang kita impor adalah HOC LogProps. +// Meskipun keluaran yang dirender akan sama, +// Ref kita akan menunjuk ke komponen LogProps daripada komponen FancyButton! +// Ini berarti kita tidak dapat memanggil ref, seperti ref.current.focus() // highlight-range{4} ; diff --git a/examples/forwarding-refs/fancy-button-simple-ref.js b/examples/forwarding-refs/fancy-button-simple-ref.js index f4d5f8e0e..58b7d7a5c 100644 --- a/examples/forwarding-refs/fancy-button-simple-ref.js +++ b/examples/forwarding-refs/fancy-button-simple-ref.js @@ -5,6 +5,6 @@ const FancyButton = React.forwardRef((props, ref) => ( )); -// You can now get a ref directly to the DOM button: +// Sekarang Anda bisa mendapatkan ref langsung ke button DOM: const ref = React.createRef(); -Click me!; +Klik saya!; diff --git a/examples/forwarding-refs/fancy-button.js b/examples/forwarding-refs/fancy-button.js index 9dcd13e16..af8acc502 100644 --- a/examples/forwarding-refs/fancy-button.js +++ b/examples/forwarding-refs/fancy-button.js @@ -6,7 +6,7 @@ class FancyButton extends React.Component { // ... } -// Rather than exporting FancyButton, we export LogProps. -// It will render a FancyButton though. +// Daripada mengekspor FancyButton, kita mengekspor LogProps. +// LogProps tetap akan me-render FancyButton. // highlight-next-line export default logProps(FancyButton); diff --git a/examples/forwarding-refs/log-props-after.js b/examples/forwarding-refs/log-props-after.js index a603bd697..cf5f0c308 100644 --- a/examples/forwarding-refs/log-props-after.js +++ b/examples/forwarding-refs/log-props-after.js @@ -9,15 +9,15 @@ function logProps(Component) { // highlight-next-line const {forwardedRef, ...rest} = this.props; - // Assign the custom prop "forwardedRef" as a ref + // Masukan prop kustom "forwardedRef" sebagai ref // highlight-next-line return ; } } - // Note the second param "ref" provided by React.forwardRef. - // We can pass it along to LogProps as a regular prop, e.g. "forwardedRef" - // And it can then be attached to the Component. + // Catat param kedua "ref" yang disediakan oleh React.forwardRef. + // Kita dapat meneruskannya ke LogProps sebagai regular prop, misalnya "forwardedRef" + // Dan kemudian dapat dilampirkan ke Komponen. // highlight-range{1-3} return React.forwardRef((props, ref) => { return ;