diff --git a/.eslintignore b/.eslintignore index 942541715..96a4c64db 100644 --- a/.eslintignore +++ b/.eslintignore @@ -7,4 +7,4 @@ content/* public/* # Ignore examples -examples/* \ No newline at end of file +examples/* diff --git a/content/docs/hooks-faq.md b/content/docs/hooks-faq.md index 851d136df..9034ed817 100644 --- a/content/docs/hooks-faq.md +++ b/content/docs/hooks-faq.md @@ -109,7 +109,9 @@ You can continue to use the exact same APIs as you always have; they'll continue React Redux since v7.1.0 [supports Hooks API](https://react-redux.js.org/api/hooks) and exposes hooks like `useDispatch` or `useSelector`. -Libraries like React Router might support hooks in the future. +React Router [supports hooks](https://reacttraining.com/react-router/web/api/Hooks) since v5.1. + +Other libraries might support hooks in the future too. ### Do Hooks work with static typing? {#do-hooks-work-with-static-typing} @@ -371,7 +373,7 @@ Note how this would work for props, state, or any other calculated value. function Counter() { const [count, setCount] = useState(0); - const calculation = count * 100; + const calculation = count + 100; const prevCalculation = usePrevious(calculation); // ... ``` @@ -655,7 +657,7 @@ function ProductPage({ productId }) { return ; } -function ProductDetails({ fetchProduct }) +function ProductDetails({ fetchProduct }) { useEffect(() => { fetchProduct(); }, [fetchProduct]); // ✅ All useEffect dependencies are specified diff --git a/content/docs/jsx-in-depth.md b/content/docs/jsx-in-depth.md index eb3dc3a5b..7ff07895c 100644 --- a/content/docs/jsx-in-depth.md +++ b/content/docs/jsx-in-depth.md @@ -13,31 +13,31 @@ redirect_from: - "docs/jsx-in-depth-ko-KR.html" --- -Fundamentally, JSX just provides syntactic sugar for the `React.createElement(component, props, ...children)` function. The JSX code: +Pada dasarnya, JSX hanya menyediakan sintaksis-sintaksis yang mudah ditulis dan dimengerti (*syntatic sugar*) untuk fungsi *`React.createElement(component, prop, ...children)`*. Kode JSX: ```js - Click Me + Klik saya ``` -compiles into: +di-*compile* menjadi: ```js React.createElement( MyButton, {color: 'blue', shadowSize: 2}, - 'Click Me' + 'Klik saya' ) ``` -You can also use the self-closing form of the tag if there are no children. So: +Anda juga dapat menggunakan *self-closing form* dari *tag* jika tidak ada turunan (*children*). Jadinya: ```js
``` -compiles into: +di-*compile* menjadi: ```js React.createElement( @@ -47,19 +47,19 @@ React.createElement( ) ``` -If you want to test out how some specific JSX is converted into JavaScript, you can try out [the online Babel compiler](babel://jsx-simple-example). +Jika Anda ingin mencoba bagaimana JSX yang spesifik JSX dikonversi menjadi JavaScript, cobalah [*Babel compiler* daring](babel://jsx-simple-example) ini. -## Specifying The React Element Type {#specifying-the-react-element-type} +## Spesifikasi Jenis Elemen React {#specifying-the-react-element-type} -The first part of a JSX tag determines the type of the React element. +Bagian pertama dari sebuah penanda (*tag*) JSX menentukan jenis dari elemen React. -Capitalized types indicate that the JSX tag is referring to a React component. These tags get compiled into a direct reference to the named variable, so if you use the JSX `` expression, `Foo` must be in scope. +Jenis-jenis yang dikapitalisasi menandakan bahwa penanda JSX merujuk pada sebuah komponen React. Penanda-penanda ini dikompilasi menjadi sebuah acuan langsung ke variabe yang sudah diberi nama, jadi jika Anda menggunakan ekspresi JSX ``, `Foo` harus berada dalam cakupan (*scope*). -### React Must Be in Scope {#react-must-be-in-scope} +### React Harus Berada dalam Cakupan {#react-must-be-in-scope} -Since JSX compiles into calls to `React.createElement`, the `React` library must also always be in scope from your JSX code. +Semenjak JSX mengompilasi jadi panggilan-panggilan pada `React.createElement`, `React` library juga harus selalu berada dalam cakupan dari kode JSX Anda. -For example, both of the imports are necessary in this code, even though `React` and `CustomButton` are not directly referenced from JavaScript: +Contohnya, kedua import tersebut dibutuhkan dalam kode ini, bahkan ketika `React` dan `CustomButton` tidak secara langsung mengacu dari JavaScript: ```js{1,2,5} import React from 'react'; @@ -71,11 +71,11 @@ function WarningButton() { } ``` -If you don't use a JavaScript bundler and loaded React from a `