Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translate Using the Effect Hook #38

Merged
merged 6 commits into from Oct 11, 2019
Merged

Conversation

RiskyFeryansyahP
Copy link
Contributor

Finally i finished this 😃 , please helps review this

@netlify
Copy link

netlify bot commented Feb 20, 2019

Deploy preview for idreactjs ready!

Built with commit 3b7a5bf

https://deploy-preview-38--idreactjs.netlify.com

Copy link
Member

@regalius regalius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @RiskyFeryansyahP , Thanks for your contribution! 🎉 So sorry that I hadn't been able to review your PR this past week, there's several terms that I think need adjustment and there also some typos, italicization, wrong capital letters, and diction that needs to be revised. If you're not sure about some of the diction, please check out some of the accepted and merged PRs and try to sync your pr with them.

Thank you!

content/docs/hooks-effect.md Outdated Show resolved Hide resolved
content/docs/hooks-effect.md Outdated Show resolved Hide resolved
content/docs/hooks-effect.md Show resolved Hide resolved
content/docs/hooks-effect.md Outdated Show resolved Hide resolved
content/docs/hooks-effect.md Outdated Show resolved Hide resolved
content/docs/hooks-effect.md Outdated Show resolved Hide resolved
content/docs/hooks-effect.md Outdated Show resolved Hide resolved
content/docs/hooks-effect.md Outdated Show resolved Hide resolved
content/docs/hooks-effect.md Outdated Show resolved Hide resolved
content/docs/hooks-effect.md Outdated Show resolved Hide resolved
@RiskyFeryansyahP
Copy link
Contributor Author

@regalius thanks for review, i will update soon

@netlify
Copy link

netlify bot commented Mar 4, 2019

Deploy preview for id-reactjs ready!

Built with commit 3b7a5bf

https://deploy-preview-38--id-reactjs.netlify.com

@grikomsn grikomsn changed the title Translation Hook-Effect Translate Using the Effect Hook Jul 10, 2019
@grikomsn grikomsn mentioned this pull request Jul 10, 2019
Copy link
Member

@resir014 resir014 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @RiskyFeryansyahP! Ada cukup banyak review item yang saya tambahkan disini, tapi jangan khawatir, sebagian besar hanya masalah konsistensi.


The *Effect Hook* lets you perform side effects in function components:
*Effect Hook* memungkinkan Anda melakukan efek samping (*side effects*) didalam *function components*:
Copy link
Member

@resir014 resir014 Sep 3, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
*Effect Hook* memungkinkan Anda melakukan efek samping (*side effects*) didalam *function components*:
*Effect Hook* memungkinkan Anda melakukan efek samping (*side effects*) didalam *function component*:


Data fetching, setting up a subscription, and manually changing the DOM in React components are all examples of side effects. Whether or not you're used to calling these operations "side effects" (or just "effects"), you've likely performed them in your components before.
Pengambilan data, pengaturan berlangganan(*subscription*) , dan perubahan manual DOM di dalam komponen React adalah beberapa contoh dari efek samping. Apakah Anda terbiasa menyebut memanggil operasi ini dengan sebutan efek samping (atau hanya "efek (*effects*)") atau tidak, Anda mungkin pernah melakukannya di dalam komponen Anda sebelumnya.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Pengambilan data, pengaturan berlangganan(*subscription*) , dan perubahan manual DOM di dalam komponen React adalah beberapa contoh dari efek samping. Apakah Anda terbiasa menyebut memanggil operasi ini dengan sebutan efek samping (atau hanya "efek (*effects*)") atau tidak, Anda mungkin pernah melakukannya di dalam komponen Anda sebelumnya.
Pengambilan data, pengaturan berlangganan (*subscription*) , dan perubahan manual DOM di dalam komponen React adalah beberapa contoh dari efek samping. Apakah Anda terbiasa menyebut memanggil operasi ini dengan sebutan efek samping (atau hanya "efek (*effects*)") atau tidak, Anda mungkin pernah melakukannya di dalam komponen Anda sebelumnya.


In React class components, the `render` method itself shouldn't cause side effects. It would be too early -- we typically want to perform our effects *after* React has updated the DOM.
Di dalam sebuah *class components* React, *method* *`render`* itu sendiri tidak seharusnya menyebabkan efek samping. Efek samping akan dijalankan terlalu awal -- kita biasanya ingin melakukan sebuah efek setelah React memperbarui DOM.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Di dalam sebuah *class components* React, *method* *`render`* itu sendiri tidak seharusnya menyebabkan efek samping. Efek samping akan dijalankan terlalu awal -- kita biasanya ingin melakukan sebuah efek setelah React memperbarui DOM.
Di dalam sebuah *class components* React, *method* `render` itu sendiri tidak seharusnya menyebabkan efek samping. Efek samping akan dijalankan terlalu awal -- kita biasanya ingin melakukan sebuah efek setelah React memperbarui DOM.

Code block jangan dijadikan italic, nanti tidak te-render dengan benar.


**Why is `useEffect` called inside a component?** Placing `useEffect` inside the component lets us access the `count` state variable (or any props) right from the effect. We don't need a special API to read it -- it's already in the function scope. Hooks embrace JavaScript closures and avoid introducing React-specific APIs where JavaScript already provides a solution.
**Kenapa `useEffect` dipanggil didalam komponen?** Meletakkan `useEffect` di dalam komponen memberikan kita akses *`count` state variable* (atau props apapun) langsung dari *effect*. Kita tidak membutuhkan API khusus untuk membacanya -- itu sudah dalam lingkup *function*. Hooks merangkul penutup JavaScript dan menghindari memperkenalkan APIs React-khusus dimana JavaScript sudah menyediakan solusinya.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**Kenapa `useEffect` dipanggil didalam komponen?** Meletakkan `useEffect` di dalam komponen memberikan kita akses *`count` state variable* (atau props apapun) langsung dari *effect*. Kita tidak membutuhkan API khusus untuk membacanya -- itu sudah dalam lingkup *function*. Hooks merangkul penutup JavaScript dan menghindari memperkenalkan APIs React-khusus dimana JavaScript sudah menyediakan solusinya.
**Kenapa `useEffect` dipanggil didalam komponen?** Meletakkan `useEffect` di dalam komponen memberikan kita akses kepada variabel *state* `count` (atau *props* apapun) langsung dari *effect*. Kita tidak membutuhkan API khusus untuk membacanya -- itu sudah dalam lingkup *function*. Hooks merangkul penutup JavaScript dan menghindari memperkenalkan APIs React-khusus dimana JavaScript sudah menyediakan solusinya.


**Does `useEffect` run after every render?** Yes! By default, it runs both after the first render *and* after every update. (We will later talk about [how to customize this](#tip-optimizing-performance-by-skipping-effects).) Instead of thinking in terms of "mounting" and "updating", you might find it easier to think that effects happen "after render". React guarantees the DOM has been updated by the time it runs the effects.
**Apakah `useEffect` berjalan setiap setelah render?** Ya! Secara standar, itu berjalan baik setelah pertama kali render *dan* setiap setelah pembaruan. (Kita akan bicarakan nanti tentang [bagimana cara menyesuaikannya](#tip-optimizing-performance-by-skipping-effects).) alih-alih berpikir dalam hal "pemasangan" dan "pembaruan", anda mungkin lebih mudah berpikir bawah *effects* terjadi "setelah *render*". React menjamin bahwa DOM telah diperbarui pada saat menjalankan *effects*.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**Apakah `useEffect` berjalan setiap setelah render?** Ya! Secara standar, itu berjalan baik setelah pertama kali render *dan* setiap setelah pembaruan. (Kita akan bicarakan nanti tentang [bagimana cara menyesuaikannya](#tip-optimizing-performance-by-skipping-effects).) alih-alih berpikir dalam hal "pemasangan" dan "pembaruan", anda mungkin lebih mudah berpikir bawah *effects* terjadi "setelah *render*". React menjamin bahwa DOM telah diperbarui pada saat menjalankan *effects*.
**Apakah `useEffect` berjalan setiap setelah render?** Ya! Secara standar, `useEffect` berjalan setelah pertama kali render *dan* setiap setelah pembaruan. (Kita akan bicarakan nanti tentang [bagimana cara menyesuaikannya](#tip-optimizing-performance-by-skipping-effects).) alih-alih berpikir dalam hal "pemasangan" dan "pembaruan", anda mungkin lebih mudah berpikir bawah *effects* terjadi "setelah *render*". React menjamin bahwa DOM telah diperbarui pada saat menjalankan *effects*.

Ambiguous "itu". It refers to the useEffect method, right?


If you're used to classes, you might be wondering why the effect cleanup phase happens after every re-render, and not just once during unmounting. Let's look at a practical example to see why this design helps us create components with fewer bugs.
Jika anda terbiasa menggunakan *classes*, anda mungkin bertanya-tanya mengapa fase pembersihan *effect* cleaup terjadi setelah setiap render ulang, dan tidak hanya sekali selama pelepasan. Mari kita lihat contoh praktis kenapa desain ini membatu kita membuat komponen dengan bug lebih sedikit.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Jika anda terbiasa menggunakan *classes*, anda mungkin bertanya-tanya mengapa fase pembersihan *effect* cleaup terjadi setelah setiap render ulang, dan tidak hanya sekali selama pelepasan. Mari kita lihat contoh praktis kenapa desain ini membatu kita membuat komponen dengan bug lebih sedikit.
Jika anda terbiasa menggunakan *classes*, anda mungkin bertanya-tanya mengapa fase pembersihan *effect* cleaup terjadi setelah setiap *render* ulang, dan tidak hanya sekali selama pelepasan. Mari kita lihat contoh praktis kenapa desain ini membatu kita membuat komponen dengan *bug* lebih sedikit.

Some missing italics here.

@@ -357,9 +357,9 @@ If you're used to classes, you might be wondering why the effect cleanup phase h
}
```

**But what happens if the `friend` prop changes** while the component is on the screen? Our component would continue displaying the online status of a different friend. This is a bug. We would also cause a memory leak or crash when unmounting since the unsubscribe call would use the wrong friend ID.
**Tapi apa yang terjadi jika `friend` prop berubah** saat komponen sudah ada di layar? Komponen kita akan terus menampilkan status online teman yang berbeda. Ini adalah bug. Kita juga akan menyebabkan kebocoran memory atau kerusakan saat pelepasan karena pemanggilan unsubscribe akan menggunakan *ID* teman yang salah.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**Tapi apa yang terjadi jika `friend` prop berubah** saat komponen sudah ada di layar? Komponen kita akan terus menampilkan status online teman yang berbeda. Ini adalah bug. Kita juga akan menyebabkan kebocoran memory atau kerusakan saat pelepasan karena pemanggilan unsubscribe akan menggunakan *ID* teman yang salah.
**Tapi apa yang terjadi jika *props* `friend` berubah** saat komponen sudah ada di layar? Komponen kita akan terus menampilkan status online teman yang berbeda. Ini adalah bug. Kita juga akan menyebabkan kebocoran memory atau kerusakan saat pelepasan karena pemanggilan unsubscribe akan menggunakan *ID* teman yang salah.

@@ -390,9 +390,9 @@ In a class component, we would need to add `componentDidUpdate` to handle this c
}
```

Forgetting to handle `componentDidUpdate` properly is a common source of bugs in React applications.
Lupa untuk menangani `componentDidUpdate` dengan benar adalah sumber bug yang umum di applikasi *React*.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Lupa untuk menangani `componentDidUpdate` dengan benar adalah sumber bug yang umum di applikasi *React*.
Lupa untuk menangani `componentDidUpdate` dengan benar adalah sumber bug yang umum di applikasi React.

No need to italicise React.

@@ -406,9 +406,9 @@ function FriendStatus(props) {
});
```

It doesn't suffer from this bug. (But we also didn't make any changes to it.)
Itu tidak memmbiarkan dari bug ini. (Tapi kita juga tidak melakukan perubahan apapun terhadapnya.)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Itu tidak memmbiarkan dari bug ini. (Tapi kita juga tidak melakukan perubahan apapun terhadapnya.)
Komponen ini tidak akan mengalami *bug* ini. (Tapi kita juga tidak melakukan perubahan apapun terhadapnya.)

>If you pass an empty array (`[]`), the props and state inside the effect will always have their initial values. While passing `[]` as the second argument is closer to the familiar `componentDidMount` and `componentWillUnmount` mental model, there are usually [better](/docs/hooks-faq.html#is-it-safe-to-omit-functions-from-the-list-of-dependencies) [solutions](/docs/hooks-faq.html#what-can-i-do-if-my-effect-dependencies-change-too-often) to avoid re-running effects too often. Also, don't forget that React defers running `useEffect` until after the browser has painted, so doing extra work is less of a problem.
>
>We recommend using the [`exhaustive-deps`](https://github.com/facebook/react/issues/14920) rule as part of our [`eslint-plugin-react-hooks`](https://www.npmjs.com/package/eslint-plugin-react-hooks#installation) package. It warns when dependencies are specified incorrectly and suggests a fix.
>Kita merekomendasikan menggunakan [`exhaustive-deps`](https://github.com/facebook/react/issues/14920) sebagai aturan dari package [`eslint-plugin-react-hooks`](https://www.npmjs.com/package/eslint-plugin-react-hooks#installation). Akan diperingatkan ketika depedensi ditentukan dengan cara yang salah dan menyarankan perbaikan.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
>Kita merekomendasikan menggunakan [`exhaustive-deps`](https://github.com/facebook/react/issues/14920) sebagai aturan dari package [`eslint-plugin-react-hooks`](https://www.npmjs.com/package/eslint-plugin-react-hooks#installation). Akan diperingatkan ketika depedensi ditentukan dengan cara yang salah dan menyarankan perbaikan.
>Kita merekomendasikan menggunakan aturan [`exhaustive-deps`](https://github.com/facebook/react/issues/14920) dari package [`eslint-plugin-react-hooks`](https://www.npmjs.com/package/eslint-plugin-react-hooks#installation). Ini akan memperingatkan ketika depedensi ditentukan dengan cara yang salah dan menyarankan perbaikan.

@resir014 resir014 merged commit a5f3ccd into reactjs:master Oct 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants