Skip to content

Commit c266e87

Browse files
juha514lumirlumir
andauthored
docs: update Lints/exhaustive-dep (#1424)
<!-- PR을 보내주셔서 감사합니다! 여러분과 같은 기여자들이 React를 더욱 멋지게 만듭니다! 기존 이슈와 관련된 PR이라면, 아래에 이슈 번호를 추가해주세요. --> Closes: #1423 # <!-- 제목을 작성해주세요. --> <!-- 어떤 종류의 PR인지 상세 내용을 작성해주세요. --> Lints에서 exhaustive-dep 페이지 번역을 진행했습니다. ## 필수 확인 사항 - [x] [기여자 행동 강령 규약<sup>Code of Conduct</sup>](https://github.com/reactjs/ko.react.dev/blob/main/CODE_OF_CONDUCT.md) - [x] [기여 가이드라인<sup>Contributing</sup>](https://github.com/reactjs/ko.react.dev/blob/main/CONTRIBUTING.md) - [x] [공통 스타일 가이드<sup>Universal Style Guide</sup>](https://github.com/reactjs/ko.react.dev/blob/main/wiki/universal-style-guide.md) - [x] [번역을 위한 모범 사례<sup>Best Practices for Translation</sup>](https://github.com/reactjs/ko.react.dev/blob/main/wiki/best-practices-for-translation.md) - [x] [번역 용어 정리<sup>Translate Glossary</sup>](https://github.com/reactjs/ko.react.dev/blob/main/wiki/translate-glossary.md) - [x] [`textlint` 가이드<sup>Textlint Guide</sup>](https://github.com/reactjs/ko.react.dev/blob/main/wiki/textlint-guide.md) - [x] [맞춤법 검사<sup>Spelling Check</sup>](https://nara-speller.co.kr/speller/) ## 선택 확인 사항 - [ ] 번역 초안 작성<sup>Draft Translation</sup> - [ ] 리뷰 반영<sup>Resolve Reviews</sup> --------- Co-authored-by: 루밀LuMir <rpfos@naver.com>
1 parent 30be3c3 commit c266e87

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

src/content/reference/eslint-plugin-react-hooks/lints/exhaustive-deps.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@ title: exhaustive-deps
44

55
<Intro>
66

7-
Validates that dependency arrays for React hooks contain all necessary dependencies.
7+
React Hook의 의존성 배열에 필요한 모든 의존성이 포함되어 있는지 검증합니다.
88

99
</Intro>
1010

11-
## Rule Details {/*rule-details*/}
11+
## 규칙 자세히보기 {/*rule-details*/}
1212

13-
React hooks like `useEffect`, `useMemo`, and `useCallback` accept dependency arrays. When a value referenced inside these hooks isn't included in the dependency array, React won't re-run the effect or recalculate the value when that dependency changes. This causes stale closures where the hook uses outdated values.
13+
`useEffect`, `useMemo`, `useCallback`과 같은 React Hook은 의존성 배열을 받습니다. 이 Hook들 안에서 참조한 값이 의존성 배열에 포함되지 않으면 그 값이 바뀌어도 React가 effect를 다시 실행하거나 값을 다시 계산하지 않습니다. 그 결과 Hook이 예전 값을 계속 붙잡고 사용하는 "stale closure(오래된 클로저)" 문제가 생겨 최신 값이 아닌 상태로 동작하게 됩니다.
1414

15-
## Common Violations {/*common-violations*/}
15+
## 흔한 위반 사항 {/*common-violations*/}
1616

17-
This error often happens when you try to "trick" React about dependencies to control when an effect runs. Effects should synchronize your component with external systems. The dependency array tells React which values the effect uses, so React knows when to re-synchronize.
17+
이 오류는 effect 실행 시점을 조절하려고 의존성을 의도적으로 누락할 때 자주 발생합니다. Effect는 컴포넌트를 외부 시스템과 동기화하기 위한 용도여야 합니다. 의존성 배열은 effect가 어떤 값을 사용하고 있는지 React에게 알려주며, React는 이를 바탕으로 언제 다시 동기화해야 하는지 판단합니다.
1818

19-
If you find yourself fighting with the linter, you likely need to restructure your code. See [Removing Effect Dependencies](/learn/removing-effect-dependencies) to learn how.
19+
린터 경고를 계속 피하려고 하거나 맞추기 어렵다고 느낀다면, 코드 구조를 다시 구성해야 할 가능성이 큽니다. 방법은 [Effect의 의존성 제거하기](/learn/removing-effect-dependencies) 문서를 참고하세요.
2020

21-
### Invalid {/*invalid*/}
21+
### 유효하지 않음 {/*invalid*/}
2222

23-
Examples of incorrect code for this rule:
23+
이 규칙에 대한 잘못된 코드 예시
2424

2525
```js
2626
// ❌ Missing dependency
@@ -39,9 +39,9 @@ useMemo(() => {
3939
}, [items]); // Missing 'sortOrder'
4040
```
4141

42-
### Valid {/*valid*/}
42+
### 유효 {/*valid*/}
4343

44-
Examples of correct code for this rule:
44+
이 규칙에 대한 올바른 예시
4545

4646
```js
4747
// ✅ All dependencies included
@@ -55,11 +55,11 @@ useEffect(() => {
5555
}, [userId]);
5656
```
5757

58-
## Troubleshooting {/*troubleshooting*/}
58+
## 문제 해결 {/*troubleshooting*/}
5959

60-
### Adding a function dependency causes infinite loops {/*function-dependency-loops*/}
60+
### 함수를 의존성으로 추가하면 무한 루프가 발생할 수 있습니다 {/*function-dependency-loops*/}
6161

62-
You have an effect, but you're creating a new function on every render:
62+
effect를 사용하고 있지만, 렌더링이 일어날 때마다 새로운 함수를 매번 생성하고 있습니다.
6363

6464
```js
6565
// ❌ Causes infinite loop
@@ -72,7 +72,7 @@ useEffect(() => {
7272
}, [logItems]); // Infinite loop!
7373
```
7474

75-
In most cases, you don't need the effect. Call the function where the action happens instead:
75+
대부분의 경우 effect는 필요하지 않습니다. 대신 그 동작이 실제로 발생하는 지점에서 함수를 호출하세요.
7676

7777
```js
7878
// ✅ Call it from the event handler
@@ -88,7 +88,7 @@ items.forEach(item => {
8888
});
8989
```
9090

91-
If you genuinely need the effect (for example, to subscribe to something external), make the dependency stable:
91+
정말로 effect가 필요한 경우(예: 외부 무언가를 구독해야 하는 경우)에는, 의존성이 안정적이도록 만드세요.
9292

9393
```js
9494
// ✅ useCallback keeps the function reference stable
@@ -106,9 +106,9 @@ useEffect(() => {
106106
}, [items]);
107107
```
108108

109-
### Running an effect only once {/*effect-on-mount*/}
109+
### effect를 한 번만 실행하기 {/*effect-on-mount*/}
110110

111-
You want to run an effect once on mount, but the linter complains about missing dependencies:
111+
마운트 시점에 effect를 한 번만 실행하고 싶지만, 린터가 누락된 의존성에 대해 경고합니다.
112112

113113
```js
114114
// ❌ Missing dependency
@@ -117,7 +117,7 @@ useEffect(() => {
117117
}, []); // Missing 'userId'
118118
```
119119

120-
Either include the dependency (recommended) or use a ref if you truly need to run once:
120+
의존성을 포함하는 것이 권장되며, 정말로 한 번만 실행해야 한다면 Ref를 사용하세요.
121121

122122
```js
123123
// ✅ Include dependency
@@ -138,9 +138,9 @@ useEffect(() => {
138138
}, [userId]);
139139
```
140140

141-
## Options {/*options*/}
141+
## 옵션 {/*options*/}
142142

143-
You can configure custom effect hooks using shared ESLint settings (available in `eslint-plugin-react-hooks` 6.1.1 and later):
143+
공유 ESLint 설정을 사용해 커스텀 Effect Hook을 설정할 수 있습니다(`eslint-plugin-react-hooks` 6.1.1 이상에서 지원).
144144

145145
```js
146146
{
@@ -152,9 +152,9 @@ You can configure custom effect hooks using shared ESLint settings (available in
152152
}
153153
```
154154

155-
- `additionalEffectHooks`: Regex pattern matching custom hooks that should be checked for exhaustive dependencies. This configuration is shared across all `react-hooks` rules.
155+
- `additionalEffectHooks`: 철저한 의존성 검사를 적용해야 하는 커스텀 Hook을 정규식 패턴으로 지정합니다. 이 설정은 모든 `react-hooks` 규칙에서 공통으로 사용됩니다.
156156

157-
For backward compatibility, this rule also accepts a rule-level option:
157+
하위 호환성을 위해 이 규칙은 규칙 단위 옵션도 함께 지원합니다.
158158

159159
```js
160160
{
@@ -166,4 +166,4 @@ For backward compatibility, this rule also accepts a rule-level option:
166166
}
167167
```
168168

169-
- `additionalHooks`: Regex for hooks that should be checked for exhaustive dependencies. **Note:** If this rule-level option is specified, it takes precedence over the shared `settings` configuration.
169+
- `additionalHooks`: 빠짐없는 의존성 검사(exhaustive deps)를 적용해야 하는 Hook을 정규식으로 지정합니다. **참고:** 이 규칙별 옵션을 지정하면 공유 `settings` 설정보다 우선 적용됩니다.

0 commit comments

Comments
 (0)