Skip to content

Commit d49f15a

Browse files
BeomyeonAndrewKimsimsim0709
authored andcommitted
Translate Rules of Hooks (#63)
* Translate Rules of Hooks * Correct trivial mistranslation * Translate nav menu * Correct trivial mistranslation * Correct 1st review * Correct 1st review * Correct mintranslation based on 2nd review
1 parent ec007d3 commit d49f15a

File tree

3 files changed

+47
-47
lines changed

3 files changed

+47
-47
lines changed

โ€Žcontent/community/conferences.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ April 12, 2019 in Amsterdam, The Netherlands
2727

2828
[Website](https://react.amsterdam) - [Twitter](https://twitter.com/reactamsterdam) - [Facebook](https://www.facebook.com/reactamsterdam)
2929

30-
### ReactJS Girls Conference
30+
### ReactJS Girls Conference {#reactjs-girls-conference}
3131
May 3, 2019 in London, UK
3232

3333
[Website](https://reactjsgirls.com/) - [Twitter](https://twitter.com/reactjsgirls)

โ€Žcontent/docs/hooks-rules.md

+45-45
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
11
---
22
id: hooks-rules
3-
title: Rules of Hooks
3+
title: Hook์˜ ๊ทœ์น™
44
permalink: docs/hooks-rules.html
55
next: hooks-custom.html
66
prev: hooks-effect.html
77
---
88

9-
*Hooks* are a new addition in React 16.8. They let you use state and other React features without writing a class.
9+
*Hook*์€ React 16.8์— ์ƒˆ๋กœ ์ถ”๊ฐ€๋œ ๊ธฐ๋Šฅ์ž…๋‹ˆ๋‹ค. Hook์€ class๋ฅผ ์ž‘์„ฑํ•˜์ง€ ์•Š๊ณ ๋„ state์™€ ๋‹ค๋ฅธ React์˜ ๊ธฐ๋Šฅ๋“ค์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•ด์ค๋‹ˆ๋‹ค.
1010

11-
Hooks are JavaScript functions, but you need to follow two rules when using them. We provide a [linter plugin](https://www.npmjs.com/package/eslint-plugin-react-hooks) to enforce these rules automatically:
11+
Hook์€ JavaScript ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ Hook์„ ์‚ฌ์šฉํ•  ๋•Œ๋Š” ๋‘ ๊ฐ€์ง€ ๊ทœ์น™์„ ์ค€์ˆ˜ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์šฐ๋ฆฌ๋Š” ์ด๋Ÿฌํ•œ ๊ทœ์น™๋“ค์„ ์ž๋™์œผ๋กœ ๊ฐ•์ œํ•˜๊ธฐ ์œ„ํ•œ [linter ํ”Œ๋Ÿฌ๊ทธ์ธ](https://www.npmjs.com/package/eslint-plugin-react-hooks)์„ ์ œ๊ณตํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.
1212

13-
### Only Call Hooks at the Top Level {#only-call-hooks-at-the-top-level}
13+
### ์ตœ์ƒ์œ„(at the Top Level)์—์„œ๋งŒ Hook์„ ํ˜ธ์ถœํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค {#only-call-hooks-at-the-top-level}
1414

15-
**Don't call Hooks inside loops, conditions, or nested functions.** Instead, always use Hooks at the top level of your React function. By following this rule, you ensure that Hooks are called in the same order each time a component renders. That's what allows React to correctly preserve the state of Hooks between multiple `useState` and `useEffect` calls. (If you're curious, we'll explain this in depth [below](#explanation).)
15+
**๋ฐ˜๋ณต๋ฌธ, ์กฐ๊ฑด๋ฌธ ํ˜น์€ ์ค‘์ฒฉ๋œ ํ•จ์ˆ˜ ๋‚ด์—์„œ Hook์„ ํ˜ธ์ถœํ•˜์ง€ ๋งˆ์„ธ์š”.** ๋Œ€์‹  ํ•ญ์ƒ React ํ•จ์ˆ˜์˜ ์ตœ์ƒ์œ„(at the top level)์—์„œ Hook์„ ํ˜ธ์ถœํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์ด ๊ทœ์น™์„ ๋”ฐ๋ฅด๋ฉด ์ปดํฌ๋„ŒํŠธ๊ฐ€ ๋ Œ๋”๋ง ๋  ๋•Œ๋งˆ๋‹ค ํ•ญ์ƒ ๋™์ผํ•œ ์ˆœ์„œ๋กœ Hook์ด ํ˜ธ์ถœ๋˜๋Š” ๊ฒƒ์ด ๋ณด์žฅ๋ฉ๋‹ˆ๋‹ค. ์ด๋Ÿฌํ•œ ์ ์€ React๊ฐ€ `useState` ์™€ `useEffect` ๊ฐ€ ์—ฌ๋Ÿฌ ๋ฒˆ ํ˜ธ์ถœ๋˜๋Š” ์ค‘์—๋„ Hook์˜ ์ƒํƒœ๋ฅผ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์œ ์ง€ํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•ด์ค๋‹ˆ๋‹ค. ์ด ์ ์— ๋Œ€ํ•ด์„œ ๊ถ๊ธˆํ•˜๋‹ค๋ฉด [์•„๋ž˜](#explanation)์—์„œ ์ž์„ธํžˆ ์„ค๋ช…ํ•ด ๋“œ๋ฆฌ๊ฒ ์Šต๋‹ˆ๋‹ค.
1616

17-
### Only Call Hooks from React Functions {#only-call-hooks-from-react-functions}
17+
### ์˜ค์ง React ํ•จ์ˆ˜ ๋‚ด์—์„œ Hook์„ ํ˜ธ์ถœํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค {#only-call-hooks-from-react-functions}
1818

19-
**Don't call Hooks from regular JavaScript functions.** Instead, you can:
19+
**Hook์„ ์ผ๋ฐ˜์ ์ธ JavaScript ํ•จ์ˆ˜์—์„œ ํ˜ธ์ถœํ•˜์ง€ ๋งˆ์„ธ์š”.** ๋Œ€์‹  ์•„๋ž˜์™€ ๊ฐ™์ด ํ˜ธ์ถœํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
2020

21-
* โœ… Call Hooks from React function components.
22-
* โœ… Call Hooks from custom Hooks (we'll learn about them [on the next page](/docs/hooks-custom.html)).
21+
* โœ… React ํ•จ์ˆ˜ ์ปดํฌ๋„ŒํŠธ์—์„œ Hook์„ ํ˜ธ์ถœํ•˜์„ธ์š”.
22+
* โœ… Custom Hook์—์„œ Hook์„ ํ˜ธ์ถœํ•˜์„ธ์š”. ([๋‹ค์Œ ํŽ˜์ด์ง€](/docs/hooks-custom.html)์—์„œ ์ด ๋ถ€๋ถ„์„ ์‚ดํŽด๋ณผ ์˜ˆ์ •์ž…๋‹ˆ๋‹ค)
2323

24-
By following this rule, you ensure that all stateful logic in a component is clearly visible from its source code.
24+
์ด ๊ทœ์น™์„ ์ง€ํ‚ค๋ฉด ์ปดํฌ๋„ŒํŠธ์˜ ๋ชจ๋“  ์ƒํƒœ ๊ด€๋ จ ๋กœ์ง์„ ์†Œ์Šค์ฝ”๋“œ์—์„œ ๋ช…ํ™•ํ•˜๊ฒŒ ๋ณด์ด๋„๋ก ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
2525

26-
## ESLint Plugin {#eslint-plugin}
26+
## ESLint ํ”Œ๋Ÿฌ๊ทธ์ธ {#eslint-plugin}
2727

28-
We released an ESLint plugin called [`eslint-plugin-react-hooks`](https://www.npmjs.com/package/eslint-plugin-react-hooks) that enforces these two rules. You can add this plugin to your project if you'd like to try it:
28+
์šฐ๋ฆฌ๋Š” ์ด ๋‘ ๊ฐ€์ง€ ๊ทœ์น™์„ ๊ฐ•์ œํ•˜๋Š” [`eslint-plugin-react-hooks`](https://www.npmjs.com/package/eslint-plugin-react-hooks) ๋ผ๋Š” ESLint ํ”Œ๋Ÿฌ๊ทธ์ธ์„ ์ถœ์‹œํ–ˆ์Šต๋‹ˆ๋‹ค. ์ด ํ”Œ๋Ÿฌ๊ทธ์ธ์„ ํ”„๋กœ์ ํŠธ์— ์ถ”๊ฐ€ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
2929

3030
```bash
3131
npm install eslint-plugin-react-hooks
3232
```
3333

3434
```js
35-
// Your ESLint configuration
35+
// ESLint ์„ค์ • ํŒŒ์ผ
3636
{
3737
"plugins": [
3838
// ...
@@ -46,28 +46,28 @@ npm install eslint-plugin-react-hooks
4646
}
4747
```
4848

49-
In the future, we intend to include this plugin by default into Create React App and similar toolkits.
49+
์•ž์œผ๋กœ๋Š” Create React App์ด๋‚˜ ๋‹ค๋ฅธ ๋น„์Šทํ•œ ๊ฐœ๋ฐœ ๋„๊ตฌ์— ๊ธฐ๋ณธ์ ์œผ๋กœ ์ด ํ”Œ๋Ÿฌ๊ทธ์ธ์„ ํฌํ•จํ•  ์˜ˆ์ •์ž…๋‹ˆ๋‹ค.
5050

51-
**You can skip to the next page explaining how to write [your own Hooks](/docs/hooks-custom.html) now.** On this page, we'll continue by explaining the reasoning behind these rules.
51+
**์–ด๋–ป๊ฒŒ [๋‚˜๋งŒ์˜ Hook](/docs/hooks-custom.html)์„ ์ž‘์„ฑํ•  ์ˆ˜ ์žˆ๋Š”์ง€ ์„ค๋ช…ํ•˜๋Š” ๋‹ค์Œ ์žฅ์œผ๋กœ ์ง€๊ธˆ ๋„˜์–ด๊ฐ€๋„ ์ข‹์Šต๋‹ˆ๋‹ค.** ์ด๋ฒˆ ์žฅ์—์„œ๋Š” ๊ณ„์†ํ•ด์„œ ์ด๋Ÿฌํ•œ ๊ทœ์น™๋“ค์˜ ๋…ผ๋ฆฌ์  ๊ทผ๊ฑฐ์— ๋Œ€ํ•ด ์„ค๋ช…ํ•  ์˜ˆ์ •์ž…๋‹ˆ๋‹ค.
5252

53-
## Explanation {#explanation}
53+
## ์„ค๋ช… {#explanation}
5454

55-
As we [learned earlier](/docs/hooks-state.html#tip-using-multiple-state-variables), we can use multiple State or Effect Hooks in a single component:
55+
[์ด์ „์— ๋ฐฐ์› ๋“ฏ์ด](/docs/hooks-state.html#tip-using-multiple-state-variables) ํ•œ ์ปดํฌ๋„ŒํŠธ์—์„œ State๋‚˜ Effect Hook์„ ์—ฌ๋Ÿฌ ๊ฐœ ์‚ฌ์šฉํ•  ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค.
5656

5757
```js
5858
function Form() {
59-
// 1. Use the name state variable
59+
// 1. name์ด๋ผ๋Š” state ๋ณ€์ˆ˜๋ฅผ ์‚ฌ์šฉํ•˜์„ธ์š”.
6060
const [name, setName] = useState('Mary');
6161

62-
// 2. Use an effect for persisting the form
62+
// 2. Effect๋ฅผ ์‚ฌ์šฉํ•ด ํผ ๋ฐ์ดํ„ฐ๋ฅผ ์ €์žฅํ•˜์„ธ์š”.
6363
useEffect(function persistForm() {
6464
localStorage.setItem('formData', name);
6565
});
6666

67-
// 3. Use the surname state variable
67+
// 3. surname์ด๋ผ๋Š” state ๋ณ€์ˆ˜๋ฅผ ์‚ฌ์šฉํ•˜์„ธ์š”.
6868
const [surname, setSurname] = useState('Poppins');
6969

70-
// 4. Use an effect for updating the title
70+
// 4. Effect๋ฅผ ์‚ฌ์šฉํ•ด์„œ ์ œ๋ชฉ์„ ์—…๋ฐ์ดํŠธํ•ฉ๋‹ˆ๋‹ค.
7171
useEffect(function updateTitle() {
7272
document.title = name + ' ' + surname;
7373
});
@@ -76,63 +76,63 @@ function Form() {
7676
}
7777
```
7878

79-
So how does React know which state corresponds to which `useState` call? The answer is that **React relies on the order in which Hooks are called**. Our example works because the order of the Hook calls is the same on every render:
79+
๊ทธ๋ ‡๋‹ค๋ฉด React๋Š” ์–ด๋–ป๊ฒŒ ํŠน์ • state๊ฐ€ ์–ด๋–ค `useState` ํ˜ธ์ถœ์— ํ•ด๋‹นํ•˜๋Š”์ง€ ์•Œ ์ˆ˜ ์žˆ์„๊นŒ์š”? **์ •๋‹ต์€ React๊ฐ€ Hook์ด ํ˜ธ์ถœ๋˜๋Š” ์ˆœ์„œ์— ์˜์กดํ•œ๋‹ค๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค.** ๋ชจ๋“  ๋ Œ๋”๋ง์—์„œ Hook์˜ ํ˜ธ์ถœ ์ˆœ์„œ๋Š” ๊ฐ™๊ธฐ ๋•Œ๋ฌธ์— ์˜ˆ์‹œ๊ฐ€ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ๋™์ž‘ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
8080

8181
```js
8282
// ------------
83-
// First render
83+
// ์ฒซ ๋ฒˆ์งธ ๋ Œ๋”๋ง
8484
// ------------
85-
useState('Mary') // 1. Initialize the name state variable with 'Mary'
86-
useEffect(persistForm) // 2. Add an effect for persisting the form
87-
useState('Poppins') // 3. Initialize the surname state variable with 'Poppins'
88-
useEffect(updateTitle) // 4. Add an effect for updating the title
85+
useState('Mary') // 1. 'Mary'๋ผ๋Š” name state ๋ณ€์ˆ˜๋ฅผ ์„ ์–ธํ•ฉ๋‹ˆ๋‹ค.
86+
useEffect(persistForm) // 2. ํผ ๋ฐ์ดํ„ฐ๋ฅผ ์ €์žฅํ•˜๊ธฐ ์œ„ํ•œ effect๋ฅผ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.
87+
useState('Poppins') // 3. 'Poppins'๋ผ๋Š” surname state ๋ณ€์ˆ˜๋ฅผ ์„ ์–ธํ•ฉ๋‹ˆ๋‹ค.
88+
useEffect(updateTitle) // 4. ์ œ๋ชฉ์„ ์—…๋ฐ์ดํŠธํ•˜๊ธฐ ์œ„ํ•œ effect๋ฅผ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.
8989

9090
// -------------
91-
// Second render
91+
// ๋‘ ๋ฒˆ์งธ ๋ Œ๋”๋ง
9292
// -------------
93-
useState('Mary') // 1. Read the name state variable (argument is ignored)
94-
useEffect(persistForm) // 2. Replace the effect for persisting the form
95-
useState('Poppins') // 3. Read the surname state variable (argument is ignored)
96-
useEffect(updateTitle) // 4. Replace the effect for updating the title
93+
useState('Mary') // 1. name state ๋ณ€์ˆ˜๋ฅผ ์ฝ์Šต๋‹ˆ๋‹ค.(์ธ์ž๋Š” ๋ฌด์‹œ๋ฉ๋‹ˆ๋‹ค)
94+
useEffect(persistForm) // 2. ํผ ๋ฐ์ดํ„ฐ๋ฅผ ์ €์žฅํ•˜๊ธฐ ์œ„ํ•œ effect๊ฐ€ ๋Œ€์ฒด๋ฉ๋‹ˆ๋‹ค.
95+
useState('Poppins') // 3. surname state ๋ณ€์ˆ˜๋ฅผ ์ฝ์Šต๋‹ˆ๋‹ค.(์ธ์ž๋Š” ๋ฌด์‹œ๋ฉ๋‹ˆ๋‹ค)
96+
useEffect(updateTitle) // 4. ์ œ๋ชฉ์„ ์—…๋ฐ์ดํŠธํ•˜๊ธฐ ์œ„ํ•œ effect๊ฐ€ ๋Œ€์ฒด๋ฉ๋‹ˆ๋‹ค.
9797

9898
// ...
9999
```
100100

101-
As long as the order of the Hook calls is the same between renders, React can associate some local state with each of them. But what happens if we put a Hook call (for example, the `persistForm` effect) inside a condition?
101+
Hook์˜ ํ˜ธ์ถœ ์ˆœ์„œ๊ฐ€ ๋ Œ๋”๋ง ๊ฐ„์— ๋™์ผํ•˜๋‹ค๋ฉด React๋Š” ์ง€์—ญ์ ์ธ state๋ฅผ ๊ฐ Hook์— ์—ฐ๋™์‹œํ‚ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ ๋งŒ์•ฝ์— Hook์„ ์กฐ๊ฑด๋ฌธ ์•ˆ์—์„œ(์˜ˆ๋ฅผ ๋“ค์–ด `persistForm` effect) ํ˜ธ์ถœํ•œ๋‹ค๋ฉด ์–ด๋–ค ์ผ์ด ์ผ์–ด๋‚ ๊นŒ์š”?
102102

103103
```js
104-
// ๐Ÿ”ด We're breaking the first rule by using a Hook in a condition
104+
// ๐Ÿ”ด ์กฐ๊ฑด๋ฌธ์— Hook์„ ์‚ฌ์šฉํ•จ์œผ๋กœ์จ ์ฒซ ๋ฒˆ์งธ ๊ทœ์น™์„ ๊นผ์Šต๋‹ˆ๋‹ค
105105
if (name !== '') {
106106
useEffect(function persistForm() {
107107
localStorage.setItem('formData', name);
108108
});
109109
}
110110
```
111111

112-
The `name !== ''` condition is `true` on the first render, so we run this Hook. However, on the next render the user might clear the form, making the condition `false`. Now that we skip this Hook during rendering, the order of the Hook calls becomes different:
112+
`name !== ''` ์กฐ๊ฑด์€ ์ฒซ ๋ฒˆ์งธ ๋ Œ๋”๋ง์—์„œ `true` ๊ธฐ ๋•Œ๋ฌธ์— Hook์€ ๋™์ž‘ํ•ฉ๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ ์‚ฌ์šฉ์ž๊ฐ€ ๊ทธ๋‹ค์Œ ๋ Œ๋”๋ง์—์„œ ํผ์„ ์ดˆ๊ธฐํ™”ํ•˜๋ฉด์„œ ์กฐ๊ฑด์„ `false`๋กœ ๋งŒ๋“ค ๊ฒ๋‹ˆ๋‹ค. ๋ Œ๋”๋ง ๊ฐ„์— Hook์„ ๊ฑด๋„ˆ๋›ฐ๊ธฐ ๋•Œ๋ฌธ์— Hook ํ˜ธ์ถœ ์ˆœ์„œ๋Š” ๋‹ฌ๋ผ์ง€๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.
113113

114114
```js
115-
useState('Mary') // 1. Read the name state variable (argument is ignored)
116-
// useEffect(persistForm) // ๐Ÿ”ด This Hook was skipped!
117-
useState('Poppins') // ๐Ÿ”ด 2 (but was 3). Fail to read the surname state variable
118-
useEffect(updateTitle) // ๐Ÿ”ด 3 (but was 4). Fail to replace the effect
115+
useState('Mary') // 1. name state ๋ณ€์ˆ˜๋ฅผ ์ฝ์Šต๋‹ˆ๋‹ค. (์ธ์ž๋Š” ๋ฌด์‹œ๋ฉ๋‹ˆ๋‹ค)
116+
// useEffect(persistForm) // ๐Ÿ”ด Hook์„ ๊ฑด๋„ˆ๋›ฐ์—ˆ์Šต๋‹ˆ๋‹ค!
117+
useState('Poppins') // ๐Ÿ”ด 2 (3์ด์—ˆ๋˜). surname state ๋ณ€์ˆ˜๋ฅผ ์ฝ๋Š” ๋ฐ ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค.
118+
useEffect(updateTitle) // ๐Ÿ”ด 3 (4์˜€๋˜). ์ œ๋ชฉ์„ ์—…๋ฐ์ดํŠธํ•˜๊ธฐ ์œ„ํ•œ effect๊ฐ€ ๋Œ€์ฒด๋˜๋Š” ๋ฐ ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค.
119119
```
120120

121-
React wouldn't know what to return for the second `useState` Hook call. React expected that the second Hook call in this component corresponds to the `persistForm` effect, just like during the previous render, but it doesn't anymore. From that point, every next Hook call after the one we skipped would also shift by one, leading to bugs.
121+
React๋Š” ๋‘ ๋ฒˆ์งธ `useState` Hook ํ˜ธ์ถœ์— ๋Œ€ํ•ด ๋ฌด์—‡์„ ๋ฐ˜ํ™˜ํ• ์ง€ ๋ชฐ๋ž์Šต๋‹ˆ๋‹ค. React๋Š” ์ด์ „ ๋ Œ๋”๋ง ๋•Œ์ฒ˜๋Ÿผ ์ปดํฌ๋„ŒํŠธ ๋‚ด์—์„œ ๋‘ ๋ฒˆ์งธ Hook ํ˜ธ์ถœ์ด `persistForm` effect์™€ ์ผ์น˜ํ•  ๊ฒƒ์ด๋ผ ์˜ˆ์ƒํ–ˆ์ง€๋งŒ ๊ทธ๋ ‡์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค. ๊ทธ ์‹œ์ ๋ถ€ํ„ฐ ๊ฑด๋„ˆ๋›ด Hook ๋‹ค์Œ์— ํ˜ธ์ถœ๋˜๋Š” Hook์ด ์ˆœ์„œ๊ฐ€ ํ•˜๋‚˜์”ฉ ๋ฐ€๋ฆฌ๋ฉด์„œ ๋ฒ„๊ทธ๋ฅผ ๋ฐœ์ƒ์‹œํ‚ค๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.
122122

123-
**This is why Hooks must be called on the top level of our components.** If we want to run an effect conditionally, we can put that condition *inside* our Hook:
123+
**์ด๊ฒƒ์ด ์ปดํฌ๋„ŒํŠธ ์ตœ์ƒ์œ„(the top of level)์—์„œ Hook์ด ํ˜ธ์ถœ๋˜์–ด์•ผ๋งŒ ํ•˜๋Š” ์ด์œ ์ž…๋‹ˆ๋‹ค.** ๋งŒ์•ฝ์— ์กฐ๊ฑด๋ถ€๋กœ effect๋ฅผ ์‹คํ–‰ํ•˜๊ธฐ๋ฅผ ์›ํ•œ๋‹ค๋ฉด, ์กฐ๊ฑด๋ฌธ์„ Hook *๋‚ด๋ถ€์—* ๋„ฃ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
124124

125125
```js
126126
useEffect(function persistForm() {
127-
// ๐Ÿ‘ We're not breaking the first rule anymore
127+
// ๐Ÿ‘ ๋” ์ด์ƒ ์ฒซ ๋ฒˆ์งธ ๊ทœ์น™์„ ์–ด๊ธฐ์ง€ ์•Š์Šต๋‹ˆ๋‹ค
128128
if (name !== '') {
129129
localStorage.setItem('formData', name);
130130
}
131131
});
132132
```
133133

134-
**Note that you don't need to worry about this problem if you use the [provided lint rule](https://www.npmjs.com/package/eslint-plugin-react-hooks).** But now you also know *why* Hooks work this way, and which issues the rule is preventing.
134+
**[์ œ๊ณต๋œ lint ๊ทœ์น™](https://www.npmjs.com/package/eslint-plugin-react-hooks)์„ ํ™œ์šฉํ•œ๋‹ค๋ฉด ์ด ๋ฌธ์ œ์— ๋Œ€ํ•ด ๊ฑฑ์ •ํ•  ํ•„์š”๋Š” ์—†์Šต๋‹ˆ๋‹ค.** ๊ทธ๋Ÿฌ๋‚˜ ์ด์ œ ๋‹น์‹ ์€ ์™œ Hook์ด ์ด๋Ÿฐ ์‹์œผ๋กœ ๋™์ž‘ํ•˜๋Š”์ง€ ๊ทธ๋ฆฌ๊ณ  ์ด ๊ทœ์น™์ด ์–ด๋–ค ๋ฌธ์ œ๋ฅผ ๋ฐฉ์ง€ํ•˜๋Š”์ง€ ์•Œ๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.
135135

136-
## Next Steps {#next-steps}
136+
## ๋‹ค์Œ ๋‹จ๊ณ„ {#next-steps}
137137

138-
Finally, we're ready to learn about [writing your own Hooks](/docs/hooks-custom.html)! Custom Hooks let you combine Hooks provided by React into your own abstractions, and reuse common stateful logic between different components.
138+
๋งˆ์นจ๋‚ด [Custom Hook](/docs/hooks-custom.html)์„ ์ž‘์„ฑํ•˜๋Š” ๋ฒ•์„ ๋ฐฐ์šธ ์ค€๋น„๊ฐ€ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค! Custom Hook์€ React์—์„œ ์ œ๊ณตํ•˜๋Š” Hook์„ ๋‹น์‹ ์˜ ์ถ”์ƒํ™”๋œ ๋กœ์ง์œผ๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋„๋ก ๊ฒฐํ•ฉํ•ด์ฃผ๊ณ  ๋‹ค๋ฅธ ์ปดํฌ๋„ŒํŠธ ์‚ฌ์ด์—์„œ ๊ณตํ†ต์˜ ์ƒํƒœ ๊ด€๋ จ ๋กœ์ง์„ ์žฌ์‚ฌ์šฉ ํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•ด์ค๋‹ˆ๋‹ค.

โ€Žcontent/docs/nav.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
- id: hooks-effect
117117
title: Using the Effect Hook
118118
- id: hooks-rules
119-
title: Rules of Hooks
119+
title: Hook์˜ ๊ทœ์น™
120120
- id: hooks-custom
121121
title: Building Your Own Hooks
122122
- id: hooks-reference

0 commit comments

Comments
ย (0)