Skip to content

Commit f49d216

Browse files
committed
wip
1 parent ab4b687 commit f49d216

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

src/content/reference/eslint-plugin-react-hooks/lints/error-boundaries.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,35 @@ title: error-boundaries
44

55
<Intro>
66

7-
Validates usage of Error Boundaries instead of try/catch for errors in child components.
7+
자식 컴포넌트의 오류에 대해 try/catch 대신 Error Boundary 사용을 검증합니다.
88

99
</Intro>
1010

11-
## Rule Details {/*rule-details*/}
11+
## 규칙 세부 사항 {/*rule-details*/}
1212

13-
Try/catch blocks can't catch errors that happen during React's rendering process. Errors thrown in rendering methods or hooks bubble up through the component tree. Only [Error Boundaries](/reference/react/Component#catching-rendering-errors-with-an-error-boundary) can catch these errors.
13+
try/catch 블록은 React의 렌더링 과정에서 발생하는 오류를 잡을 수 없습니다. 렌더링 메서드나 Hook에서 발생한 오류는 컴포넌트 트리를 타고 위로 전파됩니다. 오직 [Error Boundary](/reference/react/Component#catching-rendering-errors-with-an-error-boundary)만이 이러한 오류를 잡을 수 있습니다.
1414

15-
### Invalid {/*invalid*/}
15+
### 잘못된 예 {/*invalid*/}
1616

17-
Examples of incorrect code for this rule:
17+
이 규칙에 대한 잘못된 코드 예시입니다.
1818

1919
```js
20-
//Try/catch won't catch render errors
20+
//try/catch는 렌더링 오류를 잡을 수 없음
2121
function Parent() {
2222
try {
23-
return <ChildComponent />; // If this throws, catch won't help
23+
return <ChildComponent />; // 여기서 오류가 발생하면 catch가 도움이 되지 않음
2424
} catch (error) {
2525
return <div>Error occurred</div>;
2626
}
2727
}
2828
```
2929

30-
### Valid {/*valid*/}
30+
### 올바른 예 {/*valid*/}
3131

32-
Examples of correct code for this rule:
32+
이 규칙에 대한 올바른 코드 예시입니다.
3333

3434
```js
35-
//Using error boundary
35+
//Error Boundary 사용
3636
function Parent() {
3737
return (
3838
<ErrorBoundary>
@@ -42,24 +42,24 @@ function Parent() {
4242
}
4343
```
4444

45-
## Troubleshooting {/*troubleshooting*/}
45+
## 문제 해결 {/*troubleshooting*/}
4646

47-
### Why is the linter telling me not to wrap `use` in `try`/`catch`? {/*why-is-the-linter-telling-me-not-to-wrap-use-in-trycatch*/}
47+
### 린터가 `use``try`/`catch`로 감싸지 말라고 하는 이유는 무엇인가요? {/*why-is-the-linter-telling-me-not-to-wrap-use-in-trycatch*/}
4848

49-
The `use` hook doesn't throw errors in the traditional sense, it suspends component execution. When `use` encounters a pending promise, it suspends the component and lets React show a fallback. Only Suspense and Error Boundaries can handle these cases. The linter warns against `try`/`catch` around `use` to prevent confusion as the `catch` block would never run.
49+
`use` Hook은 전통적인 의미에서 오류를 던지지 않고 컴포넌트 실행을 일시 중단합니다. `use`가 대기 중인 Promise를 만나면 컴포넌트를 일시 중단하고 React가 폴백을 표시하도록 합니다. Suspense와 Error Boundary만이 이러한 경우를 처리할 수 있습니다. 린터는 `catch` 블록이 절대 실행되지 않으므로 혼란을 방지하기 위해 `use` 주위의 `try`/`catch`에 대해 경고합니다.
5050

5151
```js
52-
//Try/catch around `use` hook
52+
// ❌ `use` Hook 주위의 try/catch
5353
function Component({promise}) {
5454
try {
55-
const data = use(promise); // Won't catch - `use` suspends, not throws
55+
const data = use(promise); // 잡을 수 없음 - `use`는 던지지 않고 일시 중단함
5656
return <div>{data}</div>;
5757
} catch (error) {
58-
return <div>Failed to load</div>; // Unreachable
58+
return <div>Failed to load</div>; // 도달 불가
5959
}
6060
}
6161

62-
// ✅ Error boundary catches `use` errors
62+
// ✅ Error Boundary가 `use` 오류를 잡음
6363
function App() {
6464
return (
6565
<ErrorBoundary fallback={<div>Failed to load</div>}>

0 commit comments

Comments
 (0)