You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If no Owner Stack is available, `null` is returned (see [Troubleshooting: The Owner Stack is `null`](#the-owner-stack-is-null)).
50
+
Owner Stack을 사용할 수 없는 경우, `null`이 반환 됩니다. ([문제해결: Owner Stack이 `null`인 경우](#the-owner-stack-is-null))
51
51
52
-
#### Caveats {/*caveats*/}
52
+
#### 주의 사항 {/*caveats*/}
53
53
54
-
- Owner Stacks are only available in development. `captureOwnerStack` will always return `null` outside of development.
54
+
- Owner Stack은 개발 환경에서만 사용할 수 있습니다. `captureOwnerStack`은 개발 환경 밖에서는 항상 `null`을 반환합니다.
55
55
56
56
<DeepDive>
57
57
58
58
#### Owner Stack vs Component Stack {/*owner-stack-vs-component-stack*/}
59
59
60
-
The Owner Stack is different from the Component Stack available in React error handlers like [`errorInfo.componentStack` in `onUncaughtError`](/reference/react-dom/client/hydrateRoot#show-a-dialog-for-uncaught-errors).
60
+
The Owner Stack은 [`errorInfo.componentStack` in `onUncaughtError`](/reference/react-dom/client/hydrateRoot#show-a-dialog-for-uncaught-errors)와 같은 리액트 에러 핸들러에서 사용할 수 있는 Component Stack과 다릅니다.
`SubComponent`에서 에러가 날 때, 에러의 Component Stack은 다음과 같을 수 있습니다.
141
140
142
141
```
143
142
at SubComponent
@@ -147,24 +146,23 @@ at main
147
146
at React.Suspense
148
147
at App
149
148
```
150
-
151
-
However, the Owner Stack would only read
149
+
그러나 Owner Stack은 이렇게만 읽습니다.
152
150
153
151
```
154
152
at Component
155
153
```
156
154
157
-
Neither `App` nor the DOM components (e.g.`fieldset`) are considered Owners in this Stack since they didn't contribute to "creating" the node containing `SubComponent`. `App` and DOM components only forwarded the node. `App` just rendered the `children` node as opposed to `Component` which created a node containing `SubComponent` via `<SubComponent />`.
155
+
`App`이나 DOM 컴포넌트들(예:`fieldset`)은 이 스택에 포함되지 않습니다. 왜냐하면 이들은 `SubComponent`를 포함하는 노드를 "생성하는" 데에 기여하지 않기 때문입니다. `App`과 DOM 컴포넌트들은 노드를 전달할 뿐입니다. `App`은 `<SubComponent />`를 통해 `SubComponent`를 포함한 노드를 생성하는 `Component`와 달리 `children` 노드만 렌더링합니다.
158
156
159
-
Neither`Navigation` nor `legend` are in the stack at all since it's only a sibling to a node containing `<SubComponent />`.
157
+
또한,`Navigation`이나 `legend`도 `<SubComponent />`를 포함하는 노드의 형제가 아니기 때문에, 스택에 없습니다.
160
158
161
-
`SubComponent` is omitted because it's already part of the callstack.
159
+
`SubComponent`는 이미 호출 스택에 포함되어 있어서 Owner Stack에 나오지 않습니다.
162
160
163
161
</DeepDive>
164
162
165
-
## Usage {/*usage*/}
163
+
## 사용법 {/*usage*/}
166
164
167
-
### Enhance a custom error overlay {/*enhance-a-custom-error-overlay*/}
@@ -183,7 +181,7 @@ console.error = function patchedConsoleError(...args) {
183
181
};
184
182
```
185
183
186
-
If you intercept <CodeStepstep={1}>`console.error`</CodeStep> calls to highlight them in an error overlay, you can call <CodeStepstep={2}>`captureOwnerStack`</CodeStep> to include the Owner Stack.
184
+
<CodeStepstep={1}>`console.error`</CodeStep> 호출을 가로채서 에러 오버레이에 표시하고 싶다면, <CodeStepstep={2}>`captureOwnerStack`</CodeStep>을 호출하여 `OwnerStack`을 포함할 수 있습니다.
187
185
188
186
<Sandpack>
189
187
@@ -347,13 +345,13 @@ export default function App() {
347
345
348
346
</Sandpack>
349
347
350
-
## Troubleshooting {/*troubleshooting*/}
348
+
## 문제 해결 {/*troubleshooting*/}
351
349
352
-
### The Owner Stack is `null` {/*the-owner-stack-is-null*/}
350
+
### Owner Stack이 `null`인 경우 {/*the-owner-stack-is-null*/}
353
351
354
-
The call of `captureOwnerStack` happened outside of a React controlled function e.g. in a `setTimeout`callback, after a `fetch`call or in a custom DOM event handler. During render, Effects, React event handlers, and React error handlers (e.g.`hydrateRoot#options.onCaughtError`) Owner Stacks should be available.
352
+
`captureOwnerStack`이 React가 제어하지 않는 함수 바깥에서 호출됐을 경우, 예를 들어 `setTimeout`콜백, `fetch`호출 후, 커스텀 DOM 이벤트 핸들러 등에서는 Owner Stack이 null이 됩니다. 렌더링 중이나 이펙트, React 이벤트 핸들러, React 에러 핸들러(예:`hydrateRoot#options.onCaughtError`) 내에서만 생성됩니다.
355
353
356
-
In the example below, clicking the button will log an empty Owner Stack because `captureOwnerStack` was called during a custom DOM event handler. The Owner Stack must be captured earlier e.g. by moving the call of `captureOwnerStack` into the Effect body.
354
+
아래 예제에서, 버튼을 클릭하면 빈 Owner Stack이 로그로 출력됩니다. 그 이유는 `captureOwnerStack`이 커스텀 이벤트 핸들러 내에서 호출되었기 때문입니다. Owner Stack은 더 이른 시점, 예를 들어 이펙트 내부에서 `captureOwnerStack`를 호출하도록 이동시켜야 올바르게 캡쳐할 수 있습니다.
357
355
<Sandpack>
358
356
359
357
```js
@@ -381,9 +379,9 @@ export default function App() {
381
379
382
380
</Sandpack>
383
381
384
-
### `captureOwnerStack` is not available {/*captureownerstack-is-not-available*/}
382
+
### `captureOwnerStack`을 사용할 수 없는 경우 {/*captureownerstack-is-not-available*/}
385
383
386
-
`captureOwnerStack` is only exported in development builds. It will be`undefined` in production builds. If `captureOwnerStack` is used in files that are bundled for production and development, you should conditionally access it from a namespace import.
384
+
`captureOwnerStack`은 개발 환경 빌드에서만 export됩니다. 프로덕션 환경 빌드에서는`undefined`입니다. `captureOwnerStack`이 개발과 프로덕션이 모두 번들링되는 파일에서 사용될 때에는 네임스페이스 임포트를 사용하고 조건부로 접근해야 합니다.
387
385
388
386
```js
389
387
// Don't use named imports of `captureOwnerStack` in files that are bundled for development and production.
0 commit comments