` DOM node is removed, React will call your `ref` callback with `null`.
+Saat *node* DOM `
` ditambahkan pada layar, React akan memanggil *callbak* dari `ref` beserta dengan `node` DOM sebagai sebuah argumen. Saat *node* DOM `
` tersebut dihapus, React akan memanggil *callback* `ref` dengan `null`
-React will also call your `ref` callback whenever you pass a *different* `ref` callback. In the above example, `(node) => { ... }` is a different function on every render. When your component re-renders, the *previous* function will be called with `null` as the argument, and the *next* function will be called with the DOM node.
+React juga akan memanggi *callback* `ref` setiap kali anda mengoper sebuah *callback* `ref` yang berbeda. Pada contoh di atas, `(node) => { ... }` adalah fungsi yang berbeda pada setiap *render*. Saat komponen anda mengalami *render* ulang, fungsi sebelumnya akan dipanggil dengan `null` sebagai argumennya, dan fungsi selanjutnya akan dipanggi dengan *node* DOM.
-#### Parameters {/*ref-callback-parameters*/}
+#### Parameter {/*ref-callback-parameters*/}
-* `node`: A DOM node or `null`. React will pass you the DOM node when the ref gets attached, and `null` when the ref gets detached. Unless you pass the same function reference for the `ref` callback on every render, the callback will get temporarily detached and re-attached during every re-render of the component.
+* `node`: Sebuah *node* DOM atau `null`. React akan mengoper kepada anda *node* DOM saat ref terpasang, dan `null` saat ref dilepas. Kecuali, jika anda mengoper referensi fungsi yang sama untuk *callback* `ref` pada setiap *render*, *callback* tersebut akan secara sementara dilepaskan dan dipasang kembali pada setiap *render* ulang dari komponen tersebut.
-#### Returns {/*returns*/}
+#### Pengembalian (Returns) {/*returns*/}
-Do not return anything from the `ref` callback.
+Jangan menggembalikan apapun pada *callback* `ref`.
---
-### React event object {/*react-event-object*/}
+### Objek event React {/*react-event-object*/}
-Your event handlers will receive a *React event object.* It is also sometimes known as a "synthetic event".
+*Event handlers* anda akan menerima sebuah *Objek Event React.* Biasanya juga dikenal sebagai "*synthetic event*".
```js
{
@@ -278,50 +277,52 @@ Your event handlers will receive a *React event object.* It is also sometimes kn
}} />
```
-It conforms to the same standard as the underlying DOM events, but fixes some browser inconsistencies.
+Itu sesuai dengan stadar yang sama dengan *events* DOM yang mendasdarinya, tetapi memperbaiki beberapa ketidakkonsistenan dari peramban web (*browser*).
+
+Beberapa *events* React tidak dipetakan secara langsung ke *events* asli dari peramban web (*browser*). Sebaagi contoh `onMouseLeave`, `e.nativeEvent` akan menunjuk ke sebuah *event* `mouseout`. Pemetaan spesifik bukan bagian dari API publik dan masih dapat berubah di masa mendatang. Jika anda memerlukan *event* peramban web (*browser*) mendasari karena alasan tertentu, bacalah dari `e.nativeEvent`.
-Some React events do not map directly to the browser's native events. For example in `onMouseLeave`, `e.nativeEvent` will point to a `mouseout` event. The specific mapping is not part of the public API and may change in the future. If you need the underlying browser event for some reason, read it from `e.nativeEvent`.
+#### Properti {/*react-event-object-properties*/}
-#### Properties {/*react-event-object-properties*/}
+Objek *event* React mengimplementasikan beberapa properti standar [`Event`](https://developer.mozilla.org/en-US/docs/Web/API/Event):
-React event objects implement some of the standard [`Event`](https://developer.mozilla.org/en-US/docs/Web/API/Event) properties:
+* [`bubbles`](https://developer.mozilla.org/en-US/docs/Web/API/Event/bubbles): Sebuah boolean. Mengembalikan apakah gelembung (*bubbles*) dari *event* melewati DOM.
+* [`cancelable`](https://developer.mozilla.org/en-US/docs/Web/API/Event/cancelable): Sebuah boolean. Mengembalikan apakah *event* dapat dibatalkan.
+* [`currentTarget`](https://developer.mozilla.org/en-US/docs/Web/API/Event/currentTarget): Sebuah *node* DOM. Mengembalikan *node* tempat handler saat ini terpasang di pohon React.
+* [`defaultPrevented`](https://developer.mozilla.org/en-US/docs/Web/API/Event/defaultPrevented): Sebuah boolean. Mengembalikan apakah `preventDefault` dipanggil.
+* [`eventPhase`](https://developer.mozilla.org/en-US/docs/Web/API/Event/eventPhase): Sebuah angka. Mengembalikan fase *event* saat ini.
+* [`isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted): Sebuah boolean. Mengembalikan apakah *event* diinisiasi oleh pengguna.
+* [`target`](https://developer.mozilla.org/en-US/docs/Web/API/Event/target): Sebuah *node* DOM. Mengembalikan *node* dimana *event* terjadi (yang bisa jadi *child* jauh).
+* [`timeStamp`](https://developer.mozilla.org/en-US/docs/Web/API/Event/timeStamp): Sebuah angkah. Mengembalikan waktu terjadinya *event*.
-* [`bubbles`](https://developer.mozilla.org/en-US/docs/Web/API/Event/bubbles): A boolean. Returns whether the event bubbles through the DOM.
-* [`cancelable`](https://developer.mozilla.org/en-US/docs/Web/API/Event/cancelable): A boolean. Returns whether the event can be canceled.
-* [`currentTarget`](https://developer.mozilla.org/en-US/docs/Web/API/Event/currentTarget): A DOM node. Returns the node to which the current handler is attached in the React tree.
-* [`defaultPrevented`](https://developer.mozilla.org/en-US/docs/Web/API/Event/defaultPrevented): A boolean. Returns whether `preventDefault` was called.
-* [`eventPhase`](https://developer.mozilla.org/en-US/docs/Web/API/Event/eventPhase): A number. Returns which phase the event is currently in.
-* [`isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted): A boolean. Returns whether the event was initiated by user.
-* [`target`](https://developer.mozilla.org/en-US/docs/Web/API/Event/target): A DOM node. Returns the node on which the event has occurred (which could be a distant child).
-* [`timeStamp`](https://developer.mozilla.org/en-US/docs/Web/API/Event/timeStamp): A number. Returns the time when the event occurred.
+Selain itu, Objek *event* React juga menyediakan properti berikut:
-Additionally, React event objects provide these properties:
+* `nativeEvent`: Sebuah DOM [`Event`](https://developer.mozilla.org/en-US/docs/Web/API/Event). Objek *event* original dari peramban web (*browser*).
-* `nativeEvent`: A DOM [`Event`](https://developer.mozilla.org/en-US/docs/Web/API/Event). The original browser event object.
+#### Metode {/*react-event-object-methods*/}
-#### Methods {/*react-event-object-methods*/}
+Objek *event* React mengimplementasikan beberapa metode standar [`Event`](https://developer.mozilla.org/en-US/docs/Web/API/Event):
-React event objects implement some of the standard [`Event`](https://developer.mozilla.org/en-US/docs/Web/API/Event) methods:
+* [`preventDefault()`](https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault): Mencegah aksi bawaan peramban web (*browser*) untuk *event* tersebut.
+* [`stopPropagation()`](https://developer.mozilla.org/en-US/docs/Web/API/Event/stopPropagation): Menghentikan propagasi *event* melalui pohon React.
-* [`preventDefault()`](https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault): Prevents the default browser action for the event.
-* [`stopPropagation()`](https://developer.mozilla.org/en-US/docs/Web/API/Event/stopPropagation): Stops the event propagation through the React tree.
+Selain itu, objek *event* React juga menyediakan metode berikut:
-Additionally, React event objects provide these methods:
+* `isDefaultPrevented()`: Mengembalikan sebuah nilai boolean yang mengindikasikan apakah `preventDefault` dipanggil.
+* `isPropagationStopped()`: Mengembalikan sebuah nilai boolean yang mengindikasikan apakah `stopPropagation` dipanggil.
+* `persist()`: Tidak digunakan dengan DOM React. Dengan React Native, panggil ini untuk membaca properti dari *event* setelah *event*.
+* `isPersistent()`: Tidak digunakan dengan DOM React. Dengan React Native, Mengembalikan apakah `persist` telah dipanggil.
-* `isDefaultPrevented()`: Returns a boolean value indicating whether `preventDefault` was called.
-* `isPropagationStopped()`: Returns a boolean value indicating whether `stopPropagation` was called.
-* `persist()`: Not used with React DOM. With React Native, call this to read event's properties after the event.
-* `isPersistent()`: Not used with React DOM. With React Native, returns whether `persist` has been called.
+#### Peringatan {/*react-event-object-caveats*/}
-#### Caveats {/*react-event-object-caveats*/}
+* Nilai dari `currentTarget`, `eventPhase`, `target`, dan `type` menunjukkan nilai yang diharapkan oleh kode React anda. Di dalamnya, React memasang *event handlers* pada akarnya, tetapi ini tidak merefleksi di objek *event* React. Sebagai contoh, `e.currentTarget` mungkin tidak sama dengan `e.nativeEvent.currentTarget`. Untuk *polyfilled events*, `e.type` (Tipe *event* React) mungkin berbeda dengan `e.nativeEvent.type` ()
-* The values of `currentTarget`, `eventPhase`, `target`, and `type` reflect the values your React code expects. Under the hood, React attaches event handlers at the root, but this is not reflected in React event objects. For example, `e.currentTarget` may not be the same as the underlying `e.nativeEvent.currentTarget`. For polyfilled events, `e.type` (React event type) may differ from `e.nativeEvent.type` (underlying type).
+ but this is not reflected in React event objects. For example, `e.currentTarget` may not be the same as the underlying `e.nativeEvent.currentTarget`. For polyfilled events, `e.type` (React event type) may differ from `e.nativeEvent.type` (tipe yang mendasari).
---
-### `AnimationEvent` handler function {/*animationevent-handler*/}
+### Fungsi `AnimationEvent` handler {/*animationevent-handler*/}
-An event handler type for the [CSS animation](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Animations/Using_CSS_animations) events.
+Sebuah tipe *event handler* untuk *events* [animasi CSS](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Animations/Using_CSS_animations).
```js
```
-#### Parameters {/*animationevent-handler-parameters*/}
+#### Parameter {/*animationevent-handler-parameters*/}
-* `e`: A [React event object](#react-event-object) with these extra [`AnimationEvent`](https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent) properties:
+* `e`: Sebuah [objek *event* React](#react-event-object) dengan tambahan properti [`AnimationEvent`](https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent):
* [`animationName`](https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent/animationName)
* [`elapsedTime`](https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent/elapsedTime)
* [`pseudoElement`](https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent)
---
-### `ClipboardEvent` handler function {/*clipboadevent-handler*/}
+### Fungsi `ClipboardEvent` handler {/*clipboadevent-handler*/}
-An event handler type for the [Clipboard API](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API) events.
+Sebuah tipe *event handler* untuk *events* [Clipboard API](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API).
```js
```
-#### Parameters {/*clipboadevent-handler-parameters*/}
+#### Parameter {/*clipboadevent-handler-parameters*/}
-* `e`: A [React event object](#react-event-object) with these extra [`ClipboardEvent`](https://developer.mozilla.org/en-US/docs/Web/API/ClipboardEvent) properties:
+* `e`: Sebuah [objek *event* React](#react-event-object) dengan tambahan properti [`ClipboardEvent`](https://developer.mozilla.org/en-US/docs/Web/API/ClipboardEvent):
* [`clipboardData`](https://developer.mozilla.org/en-US/docs/Web/API/ClipboardEvent/clipboardData)
---
-### `CompositionEvent` handler function {/*compositionevent-handler*/}
+### Fungsi `CompositionEvent` handler {/*compositionevent-handler*/}
-An event handler type for the [input method editor (IME)](https://developer.mozilla.org/en-US/docs/Glossary/Input_method_editor) events.
+Sebuah tipe *event handler* untuk *events* [*input method editor* (IME)](https://developer.mozilla.org/en-US/docs/Glossary/Input_method_editor).
```js
```
-#### Parameters {/*compositionevent-handler-parameters*/}
+#### Parameter {/*compositionevent-handler-parameters*/}
-* `e`: A [React event object](#react-event-object) with these extra [`CompositionEvent`](https://developer.mozilla.org/en-US/docs/Web/API/CompositionEvent) properties:
+* `e`: Sebuah [objek *event* React](#react-event-object) dengan tambahan properti [`CompositionEvent`](https://developer.mozilla.org/en-US/docs/Web/API/CompositionEvent):
* [`data`](https://developer.mozilla.org/en-US/docs/Web/API/CompositionEvent/data)
---
-### `DragEvent` handler function {/*dragevent-handler*/}
+### Fungsi `DragEvent` handler {/*dragevent-handler*/}
-An event handler type for the [HTML Drag and Drop API](https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API) events.
+Sebuah tipe *event handler* untuk *events* [HTML Drag and Drop API](https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API).
```js
<>
@@ -390,7 +391,7 @@ An event handler type for the [HTML Drag and Drop API](https://developer.mozilla
onDragStart={e => console.log('onDragStart')}
onDragEnd={e => console.log('onDragEnd')}
>
- Drag source
+ Sumber tarik
{ e.preventDefault(); console.log('onDragOver'); }}
onDrop={e => console.log('onDrop')}
>
- Drop target
+ Target Penurunan
>
```
-#### Parameters {/*dragevent-handler-parameters*/}
+#### Parameter {/*dragevent-handler-parameters*/}
-* `e`: A [React event object](#react-event-object) with these extra [`DragEvent`](https://developer.mozilla.org/en-US/docs/Web/API/DragEvent) properties:
+* `e`: Sebuah [objek *event* React](#react-event-object) dengan tambahan properti [`DragEvent`](https://developer.mozilla.org/en-US/docs/Web/API/DragEvent):
* [`dataTransfer`](https://developer.mozilla.org/en-US/docs/Web/API/DragEvent/dataTransfer)
- It also includes the inherited [`MouseEvent`](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent) properties:
+ Ini juga termasuk properti yang diturunkan oleh [`MouseEvent`](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent):
* [`altKey`](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/altKey)
* [`button`](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button)
@@ -428,16 +429,16 @@ An event handler type for the [HTML Drag and Drop API](https://developer.mozilla
* [`screenY`](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/screenY)
* [`shiftKey`](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/shiftKey)
- It also includes the inherited [`UIEvent`](https://developer.mozilla.org/en-US/docs/Web/API/UIEvent) properties:
+ Ini juga termasuk properti yang diturunkan oleh [`UIEvent`](https://developer.mozilla.org/en-US/docs/Web/API/UIEvent):
* [`detail`](https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail)
* [`view`](https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/view)
---
-### `FocusEvent` handler function {/*focusevent-handler*/}
+### Fungsi `FocusEvent` handler {/*focusevent-handler*/}
-An event handler type for the focus events.
+Sebuah tipe *event handler* untuk *events* fokus.
```js
```
-[See an example.](#handling-focus-events)
+[Lihat Contoh.](#handling-focus-events)
-#### Parameters {/*focusevent-handler-parameters*/}
+#### Parameter {/*focusevent-handler-parameters*/}
-* `e`: A [React event object](#react-event-object) with these extra [`FocusEvent`](https://developer.mozilla.org/en-US/docs/Web/API/FocusEvent) properties:
+* `e`: Sebuah [objek *event* React](#react-event-object) dengan tambahan properti [`FocusEvent`](https://developer.mozilla.org/en-US/docs/Web/API/FocusEvent):
* [`relatedTarget`](https://developer.mozilla.org/en-US/docs/Web/API/FocusEvent/relatedTarget)
- It also includes the inherited [`UIEvent`](https://developer.mozilla.org/en-US/docs/Web/API/UIEvent) properties:
+ Ini juga termasuk properti yang diturunkan oleh [`UIEvent`](https://developer.mozilla.org/en-US/docs/Web/API/UIEvent):
* [`detail`](https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail)
* [`view`](https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/view)
---
-### `Event` handler function {/*event-handler*/}
+### Fungsi `Event` handler {/*event-handler*/}
-An event handler type for generic events.
+Sebuah tipe *event handler* untuk *events* umum.
#### Parameters {/*event-handler-parameters*/}
-* `e`: A [React event object](#react-event-object) with no additional properties.
+* `e`: Sebuah [objek *event* React](#react-event-object) tanpa properti tambahan.
---
-### `InputEvent` handler function {/*inputevent-handler*/}
+### Fungsi `InputEvent` handler {/*inputevent-handler*/}
-An event handler type for the `onBeforeInput` event.
+Sebuah tipe *event handler* untuk *event* `onBeforeInput`.
```js
console.log('onBeforeInput')} />
```
-#### Parameters {/*inputevent-handler-parameters*/}
+#### Parameter {/*inputevent-handler-parameters*/}
-* `e`: A [React event object](#react-event-object) with these extra [`InputEvent`](https://developer.mozilla.org/en-US/docs/Web/API/InputEvent) properties:
+* `e`: Sebuah [objek *event* React](#react-event-object) dengan tambahan properti [`InputEvent`](https://developer.mozilla.org/en-US/docs/Web/API/InputEvent):
* [`data`](https://developer.mozilla.org/en-US/docs/Web/API/InputEvent/data)
---
-### `KeyboardEvent` handler function {/*keyboardevent-handler*/}
+### Fungsi `KeyboardEvent` handler {/*keyboardevent-handler*/}
-An event handler type for keyboard events.
+Sebuah tipe *event handler* untuk *event* papan ketik (*keyboard*).
```js
```
-[See an example.](#handling-keyboard-events)
+[Lihat Contoh.](#handling-keyboard-events)
#### Parameters {/*keyboardevent-handler-parameters*/}
-* `e`: A [React event object](#react-event-object) with these extra [`KeyboardEvent`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent) properties:
+* `e`: Sebuah [objek *event* React](#react-event-object) dengan tambahan properti [`KeyboardEvent`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent):
* [`altKey`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/altKey)
* [`charCode`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/charCode)
* [`code`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code)
@@ -515,16 +516,16 @@ An event handler type for keyboard events.
* [`shiftKey`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/shiftKey)
* [`which`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/which)
- It also includes the inherited [`UIEvent`](https://developer.mozilla.org/en-US/docs/Web/API/UIEvent) properties:
+ Ini juga termasuk properti yang diturunkan oleh [`UIEvent`](https://developer.mozilla.org/en-US/docs/Web/API/UIEvent):
* [`detail`](https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail)
* [`view`](https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/view)
---
-### `MouseEvent` handler function {/*mouseevent-handler*/}
+### Fungsi `MouseEvent` handler {/*mouseevent-handler*/}
-An event handler type for mouse events.
+Sebuah tipe *event handler* untuk *event* tetikus (*mouse*).
```js
```
-[See an example.](#handling-mouse-events)
+[Lihat Contoh.](#handling-mouse-events)
-#### Parameters {/*mouseevent-handler-parameters*/}
+#### Parameter {/*mouseevent-handler-parameters*/}
-* `e`: A [React event object](#react-event-object) with these extra [`MouseEvent`](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent) properties:
+* `e`: Sebuah [objek *event* React](#react-event-object) dengan tambahan properti [`MouseEvent`](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent):
* [`altKey`](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/altKey)
* [`button`](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button)
* [`buttons`](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons)
@@ -559,16 +560,16 @@ An event handler type for mouse events.
* [`screenY`](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/screenY)
* [`shiftKey`](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/shiftKey)
- It also includes the inherited [`UIEvent`](https://developer.mozilla.org/en-US/docs/Web/API/UIEvent) properties:
+ Ini juga termasuk properti yang diturunkan oleh [`UIEvent`](https://developer.mozilla.org/en-US/docs/Web/API/UIEvent):
* [`detail`](https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail)
* [`view`](https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/view)
---
-### `PointerEvent` handler function {/*pointerevent-handler*/}
+### Fungsi `PointerEvent` handler {/*pointerevent-handler*/}
-An event handler type for [pointer events.](https://developer.mozilla.org/en-US/docs/Web/API/Pointer_events)
+Sebuah tipe *event handler* untuk [*pointer events*.](https://developer.mozilla.org/en-US/docs/Web/API/Pointer_events)
```js
```
-[See an example.](#handling-pointer-events)
+[Lihat Contoh.](#handling-pointer-events)
#### Parameters {/*pointerevent-handler-parameters*/}
-* `e`: A [React event object](#react-event-object) with these extra [`PointerEvent`](https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent) properties:
+* `e`: Sebuah [objek *event* React](#react-event-object) dengan tambahan properti [`PointerEvent`](https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent):
* [`height`](https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/height)
* [`isPrimary`](https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/isPrimary)
* [`pointerId`](https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerId)
@@ -596,7 +597,7 @@ An event handler type for [pointer events.](https://developer.mozilla.org/en-US/
* [`twist`](https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/twist)
* [`width`](https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/width)
- It also includes the inherited [`MouseEvent`](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent) properties:
+ Ini juga termasuk properti yang diturunkan oleh [`MouseEvent`](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent):
* [`altKey`](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/altKey)
* [`button`](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button)
@@ -615,16 +616,16 @@ An event handler type for [pointer events.](https://developer.mozilla.org/en-US/
* [`screenY`](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/screenY)
* [`shiftKey`](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/shiftKey)
- It also includes the inherited [`UIEvent`](https://developer.mozilla.org/en-US/docs/Web/API/UIEvent) properties:
+ Ini juga termasuk properti yang diturunkan oleh [`UIEvent`](https://developer.mozilla.org/en-US/docs/Web/API/UIEvent):
* [`detail`](https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail)
* [`view`](https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/view)
---
-### `TouchEvent` handler function {/*touchevent-handler*/}
+### Fungsi `TouchEvent` handler {/*touchevent-handler*/}
-An event handler type for [touch events.](https://developer.mozilla.org/en-US/docs/Web/API/Touch_events)
+Sebuah tipe *event handler* untuk [*touch events*.](https://developer.mozilla.org/en-US/docs/Web/API/Touch_events)
```js
```
-#### Parameters {/*touchevent-handler-parameters*/}
+#### Parameter {/*touchevent-handler-parameters*/}
-* `e`: A [React event object](#react-event-object) with these extra [`TouchEvent`](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent) properties:
+* `e`: Sebuah [objek *event* React](#react-event-object) dengan tambahan properti [`TouchEvent`](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent):
* [`altKey`](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/altKey)
* [`ctrlKey`](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/ctrlKey)
* [`changedTouches`](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/changedTouches)
@@ -647,16 +648,16 @@ An event handler type for [touch events.](https://developer.mozilla.org/en-US/do
* [`touches`](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/touches)
* [`targetTouches`](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/targetTouches)
- It also includes the inherited [`UIEvent`](https://developer.mozilla.org/en-US/docs/Web/API/UIEvent) properties:
+ Ini juga termasuk properti yang diturunkan oleh [`UIEvent`](https://developer.mozilla.org/en-US/docs/Web/API/UIEvent):
* [`detail`](https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail)
* [`view`](https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/view)
---
-### `TransitionEvent` handler function {/*transitionevent-handler*/}
+### Fungsi `TransitionEvent` handler {/*transitionevent-handler*/}
-An event handler type for the CSS transition events.
+Sebuah tipe *event handler* untuk *events* transisi CSS.
```js
```
-#### Parameters {/*transitionevent-handler-parameters*/}
+#### Parameter {/*transitionevent-handler-parameters*/}
-* `e`: A [React event object](#react-event-object) with these extra [`TransitionEvent`](https://developer.mozilla.org/en-US/docs/Web/API/TransitionEvent) properties:
+* `e`: Sebuah [objek *event* React](#react-event-object) dengan tambahan properti [`TransitionEvent`](https://developer.mozilla.org/en-US/docs/Web/API/TransitionEvent):
* [`elapsedTime`](https://developer.mozilla.org/en-US/docs/Web/API/TransitionEvent/elapsedTime)
* [`propertyName`](https://developer.mozilla.org/en-US/docs/Web/API/TransitionEvent/propertyName)
* [`pseudoElement`](https://developer.mozilla.org/en-US/docs/Web/API/TransitionEvent/pseudoElement)
---
-### `UIEvent` handler function {/*uievent-handler*/}
+### Fungsi `UIEvent` handler {/*uievent-handler*/}
-An event handler type for generic UI events.
+Sebuah tipe *event handler* untuk *events* UI umum.
```js
```
-#### Parameters {/*wheelevent-handler-parameters*/}
+#### Parameter {/*wheelevent-handler-parameters*/}
-* `e`: A [React event object](#react-event-object) with these extra [`WheelEvent`](https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent) properties:
+* `e`: Sebuah [objek *event* React](#react-event-object) dengan tambahan properti [`WheelEvent`](https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent):
* [`deltaMode`](https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent/deltaMode)
* [`deltaX`](https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent/deltaX)
* [`deltaY`](https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent/deltaY)
* [`deltaZ`](https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent/deltaZ)
- It also includes the inherited [`MouseEvent`](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent) properties:
+ Ini juga termasuk properti yang diturunkan oleh [`MouseEvent`](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent):
* [`altKey`](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/altKey)
* [`button`](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button)
@@ -729,75 +730,76 @@ An event handler type for the `onWheel` event.
* [`screenY`](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/screenY)
* [`shiftKey`](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/shiftKey)
- It also includes the inherited [`UIEvent`](https://developer.mozilla.org/en-US/docs/Web/API/UIEvent) properties:
+ Ini juga termasuk properti yang diturunkan oleh [`UIEvent`](https://developer.mozilla.org/en-US/docs/Web/API/UIEvent):
* [`detail`](https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail)
* [`view`](https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/view)
---
-## Usage {/*usage*/}
+## Penggunaan {/*usage*/}
-### Applying CSS styles {/*applying-css-styles*/}
+### Mengaplikasikan *styles* CSS {/*applying-css-styles*/}
-In React, you specify a CSS class with [`className`.](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) It works like the `class` attribute in HTML:
+Dalam React, anda me
+In React, you menentukan kelas CSS dengan [`className`.](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) yang bekerja sama seperti atribut `class` di HTML:
```js
```
-Then you write the CSS rules for it in a separate CSS file:
+Lalu, anda menulis aturan CSS untuknya pada *file* CSS terpisah:
```css
-/* In your CSS */
+/* Di file CSS anda */
.avatar {
border-radius: 50%;
}
```
-React does not prescribe how you add CSS files. In the simplest case, you'll add a [`
`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link) tag to your HTML. If you use a build tool or a framework, consult its documentation to learn how to add a CSS file to your project.
+React tidak menentukan bagaimana cara anda menambahkan *file* CSS. Dalam kasus yang sederhana, anda akan menambahkan tag [`
`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link) pada HTML anda. Jika anda menggunakan sebuah alat membangun (*build tool*) atau *framework*, lihat dokumentasinya untuk mempelajari cara menambahkan file CSS ke proyek Anda.
-Sometimes, the style values depend on data. Use the `style` attribute to pass some styles dynamically:
+Terkadang, nilai dari *style* tergantung pada data. Gunakan atribut `style` untuk mengoper beberapa *styles* secara dinamis:
```js {3-6}
```
-In the above example, `style={{}}` is not a special syntax, but a regular `{}` object inside the `style={ }` [JSX curly braces.](/learn/javascript-in-jsx-with-curly-braces) We recommend only using the `style` attribute when your styles depend on JavaScript variables.
+Pada contoh di atas, `style={{}}` bukan merupakan sintaks khusus, tapi terdapat objek reguler `{}` di dalam `style={ }` [Kurung Kurawal JSX.](/learn/javascript-in-jsx-with-curly-braces) Kami merekomendasikan penggunaan atribut `style` hanya jika *styles* anda tergantung pada variabel Javascript.
```js App.js
import Avatar from './Avatar.js';
-const user = {
- name: 'Hedy Lamarr',
- imageUrl: 'https://i.imgur.com/yXOvdOSs.jpg',
- imageSize: 90,
+const pengguna = {
+ nama: 'Budi',
+ urlGambar: 'https://i.imgur.com/yXOvdOSs.jpg',
+ ukuranGambar: 90,
};
export default function App() {
- return ;
+ return ;
}
```
```js Avatar.js active
-export default function Avatar({ user }) {
+export default function Avatar({ pengguna }) {
return (
);
@@ -814,37 +816,37 @@ export default function Avatar({ user }) {
-#### How to apply multiple CSS classes conditionally? {/*how-to-apply-multiple-css-classes-conditionally*/}
+#### Bagaimana cara menerapkan beberapa kelas CSS secara kondisional? {/*how-to-apply-multiple-css-classes-conditionally*/}
-To apply CSS classes conditionally, you need to produce the `className` string yourself using JavaScript.
+Untuk menerapkan kelas CSS secara kondisional, Anda perlu menghasilkan string `className` dengan JavaScript.
-For example, `className={'row ' + (isSelected ? 'selected': '')}` will produce either `className="row"` or `className="row selected"` depending on whether `isSelected` is `true`.
+Sebagai contoh, `className={'baris ' + (sedangDipilih ? 'dipilih': '')}` akan menghasilkan antara `className="baris"` atau `className="baris dipilih"` tergantung apakah nilai dari `sedangDipilih` adalah `true`.
-To make this more readable, you can use a tiny helper library like [`classnames`:](https://github.com/JedWatson/classnames)
+Untuk membuatnya lebih mudah dipaca, anda dapat menggunakan *library* bantuan seperti [`classnames`:](https://github.com/JedWatson/classnames)
```js
import cn from 'classnames';
-function Row({ isSelected }) {
+function Baris({ sedangDipilih }) {
return (
-
+
...
);
}
```
-It is especially convenient if you have multiple conditional classes:
+Ini sangat mudah jika Anda memiliki beberapa kelas kondisional:
```js
import cn from 'classnames';
-function Row({ isSelected, size }) {
+function Baris({ sedangDipilih, ukuran }) {
return (
-
...
@@ -856,24 +858,24 @@ function Row({ isSelected, size }) {
---
-### Manipulating a DOM node with a ref {/*manipulating-a-dom-node-with-a-ref*/}
+### Memanipulasi node DOM dengan sebuah ref {/*manipulating-a-dom-node-with-a-ref*/}
-Sometimes, you'll need to get the browser DOM node associated with a tag in JSX. For example, if you want to focus an `
` when a button is clicked, you need to call [`focus()`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus) on the browser `
` DOM node.
+Terkadang, anda perlu untuk mengambil node DOM peramban web (*browser*) yang berasosiasi dengan tag di JSX. Sebagai contoh, jika anda ingin fokus pada sebuah `
` saat sebuah tombol diklik, anda harus memanggil [`focus()`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus) pada *node* DOM `
` peramban web (*browser*).
-To obtain the browser DOM node for a tag, [declare a ref](/reference/react/useRef) and pass it as the `ref` attribute to that tag:
+Untuk mendapatkan *node* DOM peramban web (*browser*) untuk sebuah tag, [deklarasikan sebuah ref](/reference/react/useRef) dan oper sebagai atribut `ref` pada tag tersebut:
```js {7}
import { useRef } from 'react';
export default function Form() {
- const inputRef = useRef(null);
+ const refMasukkan = useRef(null);
// ...
return (
-
+
// ...
```
-React will put the DOM node into `inputRef.current` after it's been rendered to the screen.
+React akan meletakkan *node* DOM ke `inputRef.current` setelah ter-*render* pada layar.
@@ -881,17 +883,17 @@ React will put the DOM node into `inputRef.current` after it's been rendered to
import { useRef } from 'react';
export default function Form() {
- const inputRef = useRef(null);
+ const refMasukkan = useRef(null);
- function handleClick() {
- inputRef.current.focus();
+ function handleKlik() {
+ refMasukkan.current.focus();
}
return (
<>
-
-
- Focus the input
+
+
+ Fokus pada input
>
);
@@ -900,24 +902,24 @@ export default function Form() {
-Read more about [manipulating DOM with refs](/learn/manipulating-the-dom-with-refs) and [check out more examples.](/reference/react/useRef#examples-dom)
+Baca lebih lanjut mengenai [memanipulasi DOM dengan refs](/learn/manipulating-the-dom-with-refs) and [lihat lebih banyak contoh.](/reference/react/useRef#examples-dom)
-For more advanced use cases, the `ref` attribute also accepts a [callback function.](#ref-callback)
+Untuk kasus yang lebih canggih, attribut `ref` juga menerima sebuah [fungsi *callback*.](#ref-callback)
---
-### Dangerously setting the inner HTML {/*dangerously-setting-the-inner-html*/}
+### Mengatur inner HTML secara bahaya {/*dangerously-setting-the-inner-html*/}
-You can pass a raw HTML string to an element like so:
+Anda dapat mengoper string HTML mentah ke sebuah elemen seperti berikut:
```js
-const markup = { __html: '
some raw html
' };
+const markup = { __html: '
beberapa HTML mentah
' };
return
;
```
-**This is dangerous. As with the underlying DOM [`innerHTML`](https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML) property, you must exercise extreme caution! Unless the markup is coming from a completely trusted source, it is trivial to introduce an [XSS](https://en.wikipedia.org/wiki/Cross-site_scripting) vulnerability this way.**
+**Hal ini berbahaya. Karena dengan properti DOM mendasar [`innerHTML`](https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML), anda harus sangat berhati-hati! Kecuali, markup tersebut berasal dari sumber yang sepenuhnya dipercayai, Itu sepele untuk memperkenalkan kerentanan [XSS](https://en.wikipedia.org/wiki/Cross-site_scripting).**
-For example, if you use a Markdown library that converts Markdown to HTML, you trust that its parser doesn't contain bugs, and the user only sees their own input, you can display the resulting HTML like this:
+Sebagai contoh, jika anda menggunakan *library* Markdown untuk mengkonversi Markdown ke HTML, Anda percaya bahwa *parser* tidak mengandung bug, dan pengguna hanya melihat masukan mereka sendiri, Anda dapat menampilkan HTML yang dihasilkan seperti ini:
@@ -930,7 +932,7 @@ export default function MarkdownEditor() {
return (
<>
- Enter some markdown:
+ Masukkan beberapa markdown
-To see why rendering arbitrary HTML is dangerous, replace the code above with this:
+Untuk mengetahui mengapa me-*render* HTML sewenang-wenang itu berbahaya, ganti kode di atas dengan ini:
```js {1-4,7,8}
const post = {
// Imagine this content is stored in the database.
- content: `
`
+ content: `
`
};
export default function MarkdownPreview() {
@@ -1000,42 +1002,42 @@ export default function MarkdownPreview() {
}
```
-The code embedded in the HTML will run. A hacker could use this security hole to steal user information or to perform actions on their behalf. **Only use `dangerouslySetInnerHTML` with trusted and sanitized data.**
+Kode yang disematkan dalam HTML akan berjalan. Seorang peretas dapat menggunakan lubang keamanan ini untuk mencuri informasi pengguna atau melakukan tindakan atas nama mereka. **Hanya gunakan `dangerouslySetInnerHTML` dengan data tepercaya dan tersanitasi.**
---
-### Handling mouse events {/*handling-mouse-events*/}
+### Penanganan *events* mouse {/*handling-mouse-events*/}
-This example shows some common [mouse events](#mouseevent-handler) and when they fire.
+Contoh dibawah ini menunjukkan beberapa [*events* mouse (tetikus)](#mouseevent-handler) umum dan saat mereka aktif.
```js
-export default function MouseExample() {
+export default function ContohMouse() {
return (
console.log('onMouseEnter (parent)')}
onMouseLeave={e => console.log('onMouseLeave (parent)')}
>
console.log('onClick (first button)')}
- onMouseDown={e => console.log('onMouseDown (first button)')}
- onMouseEnter={e => console.log('onMouseEnter (first button)')}
- onMouseLeave={e => console.log('onMouseLeave (first button)')}
- onMouseOver={e => console.log('onMouseOver (first button)')}
- onMouseUp={e => console.log('onMouseUp (first button)')}
+ onClick={e => console.log('onClick (Tombol Pertama)')}
+ onMouseDown={e => console.log('onMouseDown (Tombol Pertama)')}
+ onMouseEnter={e => console.log('onMouseEnter (Tombol Pertama)')}
+ onMouseLeave={e => console.log('onMouseLeave (Tombol Pertama)')}
+ onMouseOver={e => console.log('onMouseOver (Tombol Pertama)')}
+ onMouseUp={e => console.log('onMouseUp (Tombol Pertama)')}
>
- First button
+ Tombol Pertama
console.log('onClick (second button)')}
- onMouseDown={e => console.log('onMouseDown (second button)')}
- onMouseEnter={e => console.log('onMouseEnter (second button)')}
- onMouseLeave={e => console.log('onMouseLeave (second button)')}
- onMouseOver={e => console.log('onMouseOver (second button)')}
- onMouseUp={e => console.log('onMouseUp (second button)')}
+ onClick={e => console.log('onClick (Tombol Kedua)')}
+ onMouseDown={e => console.log('onMouseDown (Tombol Kedua)')}
+ onMouseEnter={e => console.log('onMouseEnter (Tombol Kedua)')}
+ onMouseLeave={e => console.log('onMouseLeave (Tombol Kedua)')}
+ onMouseOver={e => console.log('onMouseOver (Tombol Kedua)')}
+ onMouseUp={e => console.log('onMouseUp (Tombol Kedua)')}
>
- Second button
+ Tombol Kedua
);
@@ -1051,14 +1053,14 @@ input { margin-left: 10px; }
---
-### Handling pointer events {/*handling-pointer-events*/}
+### Penanganan *events* penunjuk {/*handling-pointer-events*/}
-This example shows some common [pointer events](#pointerevent-handler) and when they fire.
+Contoh dibawah ini menunjukkan beberapa [*events* penunjuk](#pointerevent-handler) umum dan saat mereka aktif.
```js
-export default function PointerExample() {
+export default function ContohPenunjuk() {
return (
console.log('onPointerEnter (parent)')}
@@ -1066,24 +1068,24 @@ export default function PointerExample() {
style={{ padding: 20, backgroundColor: '#ddd' }}
>
console.log('onPointerDown (first child)')}
- onPointerEnter={e => console.log('onPointerEnter (first child)')}
- onPointerLeave={e => console.log('onPointerLeave (first child)')}
- onPointerMove={e => console.log('onPointerMove (first child)')}
- onPointerUp={e => console.log('onPointerUp (first child)')}
+ onPointerDown={e => console.log('onPointerDown (Child Pertama)')}
+ onPointerEnter={e => console.log('onPointerEnter (Child Pertama)')}
+ onPointerLeave={e => console.log('onPointerLeave (Child Pertama)')}
+ onPointerMove={e => console.log('onPointerMove (Child Pertama)')}
+ onPointerUp={e => console.log('onPointerUp (Child Pertama)')}
style={{ padding: 20, backgroundColor: 'lightyellow' }}
>
- First child
+ Child Pertama
console.log('onPointerDown (second child)')}
- onPointerEnter={e => console.log('onPointerEnter (second child)')}
- onPointerLeave={e => console.log('onPointerLeave (second child)')}
- onPointerMove={e => console.log('onPointerMove (second child)')}
- onPointerUp={e => console.log('onPointerUp (second child)')}
+ onPointerDown={e => console.log('onPointerDown (Child Kedua)')}
+ onPointerEnter={e => console.log('onPointerEnter (Child Kedua)')}
+ onPointerLeave={e => console.log('onPointerLeave (Child Kedua)')}
+ onPointerMove={e => console.log('onPointerMove (Child Kedua)')}
+ onPointerUp={e => console.log('onPointerUp (Child Kedua)')}
style={{ padding: 20, backgroundColor: 'lightblue' }}
>
- Second child
+ Child Kedua
);
@@ -1099,47 +1101,48 @@ input { margin-left: 10px; }
---
-### Handling focus events {/*handling-focus-events*/}
+### Penanganan *events* fokus {/*handling-focus-events*/}
-In React, [focus events](#focusevent-handler) bubble. You can use the `currentTarget` and `relatedTarget` to differentiate if the focusing or blurring events originated from outside of the parent element. The example shows how to detect focusing a child, focusing the parent element, and how to detect focus entering or leaving the whole subtree.
+Dalam React, [*events* fokus](#focusevent-handler) menggelembung (*bubble*). Anda dapat menggunakan `currentTarget` dan `relatedTarget`
+In React, [focus events](#focusevent-handler) bubble. You can use the `currentTarget` and `relatedTarget` untuk membedakan apakah *events* pemfokusan atau pemburaman berasal dari luar elemen *parent*. Contoh tersebut menunjukkan cara mendeteksi fokus *child*, memfokuskan elemen *parent*, dan cara mendeteksi fokus masuk atau keluar dari seluruh subpohon.
```js
-export default function FocusExample() {
+export default function ContohFokus() {
return (
{
if (e.currentTarget === e.target) {
- console.log('focused parent');
+ console.log('parent yang difokus');
} else {
- console.log('focused child', e.target.name);
+ console.log('child yang difokus', e.target.name);
}
if (!e.currentTarget.contains(e.relatedTarget)) {
- // Not triggered when swapping focus between children
- console.log('focus entered parent');
+ // Tidak terpicu saat bertukar fokus di antara children
+ console.log('fokus memasukki parent');
}
}}
onBlur={(e) => {
if (e.currentTarget === e.target) {
- console.log('unfocused parent');
+ console.log('parent yang tidak difokus');
} else {
- console.log('unfocused child', e.target.name);
+ console.log('child yang tidak difokus', e.target.name);
}
if (!e.currentTarget.contains(e.relatedTarget)) {
- // Not triggered when swapping focus between children
- console.log('focus left parent');
+ // Tidak terpicu saat bertukar fokus di antara children
+ console.log('fokus meninggalkan parent');
}
}}
>
- First name:
-
+ Nama Pertama:
+
- Last name:
-
+ Nama Akhir:
+
);
@@ -1155,19 +1158,19 @@ input { margin-left: 10px; }
---
-### Handling keyboard events {/*handling-keyboard-events*/}
+### Penanganan *events* papan ketik (*keyboard*). {/*handling-keyboard-events*/}
-This example shows some common [keyboard events](#keyboardevent-handler) and when they fire.
+Contoh dibawah ini menunjukkan beberapa [*events* papan ketik (*keyboard*)](#keyboardevent-handler) umum dan saat mereka aktif.
```js
-export default function KeyboardExample() {
+export default function ContohKeyboard() {
return (
- First name:
+ Nama Pertama:
console.log('onKeyDown:', e.key, e.code)}
onKeyUp={e => console.log('onKeyUp:', e.key, e.code)}
/>