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
## Effect에서 이벤트 분리하기 {/*separating-events-from-effects*/}
314
314
315
-
Event handlers only re-run when you perform the same interaction again. Unlike event handlers, Effects re-synchronize if any of the values they read, like props or state, are different than during last render. Sometimes, you want a mix of both behaviors: an Effect that re-runs in response to some values but not others.
315
+
이벤트 핸들러는 같은 상호작용을 다시 수행할 때만 다시 실행됩니다. 이벤트 핸들러와 달리, Effect는 props나 state와 같이 읽은 값이 마지막 렌더링 때와 다르면 다시 동기화됩니다. 때로는 두 가지 동작을 혼합하여, 일부 값에만 반응하고 다른 값에는 반응하지 않는 Effect를 원할 수도 있습니다.
316
316
317
317
Effect 내의 모든 코드는 <em>반응형</em>이며, 읽은 반응형 값이 다시 렌더링되는 것으로 인해 변경되면 다시 실행됩니다. 예를 들어 다음의 Effect는 `roomId` 또는 `theme`이 변경되면 채팅에 다시 연결됩니다.
Copy file name to clipboardExpand all lines: src/content/learn/passing-data-deeply-with-context.md
+1-3Lines changed: 1 addition & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1022,9 +1022,7 @@ li {
1022
1022
1023
1023
`imageSize` prop을 모든 컴포넌트에서 제거합니다.
1024
1024
1025
-
`Context.js`에 `ImageSizeContext`를 생성하고 내보냅니다. 리스트를 `<ImageSizeContext.Provider value={imageSize}>`로 감싸 값을 아래로 전달하고 `useContext(ImageSizeContext)`로 `PlaceImage`에서 그것을 읽습니다.
1026
-
1027
-
Create and export `ImageSizeContext` from `Context.js`. Then wrap the List into `<ImageSizeContext value={imageSize}>` to pass the value down, and `useContext(ImageSizeContext)` to read it in the `PlaceImage`:
1025
+
`Context.js`에 `ImageSizeContext`를 생성하고 내보냅니다. 리스트를 `<ImageSizeContext value={imageSize}>`로 감싸 값을 아래로 전달하고 `useContext(ImageSizeContext)`로 `PlaceImage`에서 그것을 읽습니다.
Copy file name to clipboardExpand all lines: src/content/reference/react/Fragment.md
+35-34Lines changed: 35 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,9 +4,9 @@ title: <Fragment> (<>...</>)
4
4
5
5
<Intro>
6
6
7
-
`<Fragment>`, often used via `<>...</>`syntax, lets you group elements without a wrapper node.
7
+
`<Fragment>`는 `<>...</>`문법으로 자주 사용되며, 래퍼 노드 없이 엘리먼트를 그룹화할 수 있게 해줍니다.
8
8
9
-
<Canary> Fragments can also accept refs, which enable interacting with underlying DOM nodes without adding wrapper elements. See reference and usage below.</Canary>
9
+
<Canary> Fragment는 `ref`를 받을 수도 있으며, 래퍼 엘리먼트를 추가하지 않고도 기본 DOM 노드와 상호작용할 수 있습니다. 아래 레퍼런스와 사용법을 참고하세요.</Canary>
10
10
11
11
```js
12
12
<>
@@ -25,45 +25,46 @@ title: <Fragment> (<>...</>)
25
25
26
26
### `<Fragment>` {/*fragment*/}
27
27
28
-
하나의 엘리먼트가 필요한 상황에서 엘리먼트를 `<Fragment>`로 감싸서 그룹화하세요. `Fragment` 안에서 그룹화된 엘리먼트는 DOM 결과물에 영향을 주지 않습니다. 즉, 엘리먼트가 그룹화되지 않은 것과 같습니다. 대부분의 경우 빈 JSX 태그인 `<></>`는 `<Fragment></Fragment>`의 줄임말입니다.
28
+
하나의 엘리먼트가 필요한 상황에서 엘리먼트를 `<Fragment>`로 감싸서 그룹화하세요. `Fragment` 안에서 그룹화된 엘리먼트는 DOM 결과물에 영향을 주지 않습니다. 즉, 엘리먼트가 그룹화되지 않은 것과 같습니다. 대부분의 경우 빈 JSX 태그인 `<></>`는 `<Fragment></Fragment>`의 축약형입니다.
29
29
30
30
#### Props {/*props*/}
31
-
-**optional**`key`: 명시적 `<Fragment>`로 선언된 Fragment에는[`key`](/learn/rendering-lists#keeping-list-items-in-order-with-key)를 사용할 수 있습니다.
31
+
-**optional**`key`: 명시적 `<Fragment>`로 선언된 `Fragment`에는[`key`](/learn/rendering-lists#keeping-list-items-in-order-with-key)를 사용할 수 있습니다.
32
32
33
-
-**optional**`key`: Fragments declared with the explicit `<Fragment>` syntax may have [keys.](/learn/rendering-lists#keeping-list-items-in-order-with-key)
34
-
- <CanaryBadge /> **optional**`ref`: A ref object (e.g. from [`useRef`](/reference/react/useRef)) or [callback function](/reference/react-dom/components/common#ref-callback). React provides a `FragmentInstance` as the ref value that implements methods for interacting with the DOM nodes wrapped by the Fragment.
33
+
- <CanaryBadge /> **optional**`ref`: ref 객체(예: [`useRef`](/reference/react/useRef)에서 반환된 것) 또는 [콜백 함수](/reference/react-dom/components/common#ref-callback)입니다. React는 `Fragment`로 감싼 DOM 노드와 상호작용하기 위한 메서드를 구현한 `FragmentInstance`를 ref 값으로 제공합니다.
When you pass a ref to a fragment, React provides a `FragmentInstance` object with methods for interacting with the DOM nodes wrapped by the fragment:
37
+
`Fragment`에 `ref`를 전달하면, React는 `Fragment`로 감싼 DOM 노드와 상호작용하기 위한 메서드가 포함된 `FragmentInstance` 객체를 제공합니다.
39
38
40
-
**Event handling methods:**
41
-
-`addEventListener(type, listener, options?)`: Adds an event listener to all first-level DOM children of the Fragment.
42
-
-`removeEventListener(type, listener, options?)`: Removes an event listener from all first-level DOM children of the Fragment.
43
-
-`dispatchEvent(event)`: Dispatches an event to a virtual child of the Fragment to call any added listeners and can bubble to the DOM parent.
39
+
**이벤트 처리 메서드**
40
+
-`addEventListener(type, listener, options?)`: Fragment의 모든 최상위 DOM 자식에 이벤트 리스너를 추가합니다.
41
+
-`removeEventListener(type, listener, options?)`: Fragment의 모든 최상위 DOM 자식에서 이벤트 리스너를 제거합니다.
42
+
-`dispatchEvent(event)`: Fragment의 가상 자식에 이벤트를 디스패치하여 추가된 리스너를 호출하며, DOM 부모로 버블링될 수 있습니다.
44
43
45
-
**Layout methods:**
46
-
-`compareDocumentPosition(otherNode)`: Compares the document position of the Fragment with another node.
47
-
-If the Fragment has children, the native `compareDocumentPosition`value is returned.
48
-
-Empty Fragments will attempt to compare positioning within the React tree and include `Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC`.
49
-
-Elements that have a different relationship in the React tree and DOM tree due to portaling or other insertions are `Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC`.
50
-
-`getClientRects()`: Returns a flat array of`DOMRect`objects representing the bounding rectangles of all children.
51
-
-`getRootNode()`: Returns the root node containing the Fragment's parent DOM node.
44
+
**레이아웃 메서드**
45
+
-`compareDocumentPosition(otherNode)`: Fragment의 문서 위치를 다른 노드와 비교합니다.
46
+
-Fragment에 자식이 있으면 네이티브 `compareDocumentPosition`값이 반환됩니다.
47
+
-빈 Fragment는 React 트리 내에서 위치를 비교하며 `Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC`을 포함합니다.
48
+
-포탈이나 다른 삽입으로 인해 React 트리와 DOM 트리에서 다른 관계를 가진 엘리먼트는 `Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC`입니다.
49
+
-`getClientRects()`: 모든 자식의 경계 사각형을 나타내는`DOMRect`객체의 평탄화된 배열을 반환합니다.
50
+
-`getRootNode()`: Fragment의 부모 DOM 노드를 포함하는 루트 노드를 반환합니다.
52
51
53
-
**Focus management methods:**
54
-
-`focus(options?)`: Focuses the first focusable DOM node in the Fragment. Focus is attempted on nested children depth-first.
55
-
-`focusLast(options?)`: Focuses the last focusable DOM node in the Fragment. Focus is attempted on nested children depth-first.
56
-
-`blur()`: Removes focus if `document.activeElement` is within the Fragment.
52
+
**포커스 관리 메서드**
53
+
-`focus(options?)`: Fragment 내의 첫 번째 포커스 가능한 DOM 노드에 포커스합니다. 중첩된 자식에 대해 깊이 우선으로 포커스를 시도합니다.
54
+
-`focusLast(options?)`: Fragment 내의 마지막 포커스 가능한 DOM 노드에 포커스합니다. 중첩된 자식에 대해 깊이 우선으로 포커스를 시도합니다.
55
+
-`blur()`: `document.activeElement`가 Fragment 내에 있으면 포커스를 제거합니다.
57
56
58
-
**Observer methods:**
59
-
-`observeUsing(observer)`: Starts observing the Fragment's DOM children with an IntersectionObserver or ResizeObserver.
60
-
-`unobserveUsing(observer)`: Stops observing the Fragment's DOM children with the specified observer.
57
+
**옵저버 메서드**
58
+
-`observeUsing(observer)`: IntersectionObserver 또는 ResizeObserver로 Fragment의 DOM 자식을 관찰하기 시작합니다.
59
+
-`unobserveUsing(observer)`: 지정된 옵저버로 Fragment의 DOM 자식 관찰을 중지합니다.
60
+
61
+
#### 주의 사항 {/*caveats*/}
61
62
62
63
- Fragment에 `key`를 사용하려면 `<>...</>` 구문을 사용할 수 없습니다. 명시적으로 `react`에서 `Fragment`를 불러오고<sup>Import</sup> `<Fragment key={yourKey}>...</Fragment>`를 렌더링해야 합니다.
63
64
64
65
- React는 `<><Child /></>`에서 `[<Child />]`로 렌더링하거나 (또는 반대의 경우), 혹은 `<><Child /></>` 에서 `<Child />` 렌더링하거나 (또는 반대의 경우) [State를 초기화](/learn/preserving-and-resetting-state)하지 않습니다. 이는 오직 한 단계 깊이<sup>Single Level Deep</sup>까지만 적용됩니다. 예를 들어 `<><><Child /></></>` 에서 `<Child />`로 렌더링하는 것은 State가 초기화됩니다. 정확한 의미는 [여기](https://gist.github.com/clemmy/b3ef00f9507909429d8aa0d3ee4f986b)서 확인할 수 있습니다.
65
66
66
-
- <CanaryBadge /> If you want to pass `ref` to a Fragment, you can't use the `<>...</>`syntax. You have to explicitly import `Fragment` from `'react'` and render`<Fragment ref={yourRef}>...</Fragment>`.
67
+
- <CanaryBadge /> Fragment에 `ref`를 전달하려면 `<>...</>`문법을 사용할 수 없습니다. 명시적으로 `'react'`에서 `Fragment`를 불러오고`<Fragment ref={yourRef}>...</Fragment>`를 렌더링해야 합니다.
67
68
68
69
---
69
70
@@ -241,9 +242,9 @@ function PostBody({ body }) {
241
242
242
243
---
243
244
244
-
### <CanaryBadge /> Using Fragment refs for DOM interaction {/*using-fragment-refs-for-dom-interaction*/}
245
+
### <CanaryBadge /> Fragment ref를 사용한 DOM 상호작용 {/*using-fragment-refs-for-dom-interaction*/}
245
246
246
-
Fragment refs allow you to interact with the DOM nodes wrapped by a Fragment without adding extra wrapper elements. This is useful for event handling, visibility tracking, focus management, and replacing deprecated patterns like `ReactDOM.findDOMNode()`.
247
+
Fragment ref를 사용하면 래퍼 엘리먼트를 추가하지 않고도 Fragment로 감싼 DOM 노드와 상호작용할 수 있습니다. 이벤트 처리, 가시성 추적, 포커스 관리, 그리고 `ReactDOM.findDOMNode()`와 같이 더 이상 사용되지 않는 패턴을 대체하는 데 유용합니다.
247
248
248
249
```js
249
250
import { Fragment } from'react';
@@ -261,9 +262,9 @@ function ClickableFragment({ children, onClick }) {
261
262
```
262
263
---
263
264
264
-
### <CanaryBadge /> Tracking visibility with Fragment refs {/*tracking-visibility-with-fragment-refs*/}
265
+
### <CanaryBadge /> Fragment ref로 가시성 추적하기 {/*tracking-visibility-with-fragment-refs*/}
265
266
266
-
Fragment refs are useful for visibility tracking and intersection observation. This enables you to monitor when content becomes visible without requiring the child Components to expose refs:
267
+
Fragment ref는 가시성 추적과 교차 관찰에 유용합니다. 자식 컴포넌트가 ref를 노출하지 않아도 콘텐츠가 화면에 보이는 시점을 모니터링할 수 있습니다.
This pattern is an alternative to Effect-based visibility logging, which is an anti-pattern in most cases. Relying on Effects alone does not guarantee that the rendered Component is observable by the user.
308
+
이 패턴은 Effect 기반 가시성 로깅의 대안이며, Effect 기반 방식은 대부분의 경우 안티패턴입니다. Effect에만 의존하면 렌더링된 컴포넌트가 사용자에게 실제로 보이는지 보장할 수 없습니다.
308
309
309
310
---
310
311
311
-
### <CanaryBadge /> Focus management with Fragment refs {/*focus-management-with-fragment-refs*/}
312
+
### <CanaryBadge /> Fragment ref로 포커스 관리하기 {/*focus-management-with-fragment-refs*/}
312
313
313
-
Fragment refs provide focus management methods that work across all DOM nodes within the Fragment:
314
+
Fragment ref는 Fragment 내의 모든 DOM 노드에서 동작하는 포커스 관리 메서드를 제공합니다.
314
315
315
316
```js
316
317
import { Fragment, useRef } from'react';
@@ -324,4 +325,4 @@ function FocusFragment({ children }) {
324
325
}
325
326
```
326
327
327
-
The `focus()`method focuses the first focusable element within the Fragment, while `focusLast()` focuses the last focusable element.
328
+
`focus()`메서드는 Fragment 내의 첫 번째 포커스 가능한 엘리먼트에 포커스하고, `focusLast()`는 마지막 포커스 가능한 엘리먼트에 포커스합니다.
Copy file name to clipboardExpand all lines: src/content/reference/react/useImperativeHandle.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -170,9 +170,9 @@ input {
170
170
171
171
---
172
172
173
-
### 사용자 정의 Imperative 메서드 노출 {/*exposing-your-own-imperative-methods*/}
173
+
### 사용자 정의 명령형 메서드 노출 {/*exposing-your-own-imperative-methods*/}
174
174
175
-
Imperative Handle을 통해 노출하는 메서드는 DOM 메서드와 정확하게 일치할 필요가 없습니다. 예를 들어, 이 `Post` 컴포넌트는 Imperative Handle을 통해 `scrollAndFocusAddComment` 메서드를 표시합니다. 이렇게 하면 부모 `Page`에서 버튼을 클릭할 때 댓글 목록을 스크롤하고 입력 필드에 초점을 맞출 수 있습니다.
175
+
명령형 핸들<sup>Imperative Handle</sup>을 통해 노출하는 메서드는 DOM 메서드와 정확하게 일치할 필요가 없습니다. 예를 들어, 이 `Post` 컴포넌트는 명령형 핸들을 통해 `scrollAndFocusAddComment` 메서드를 표시합니다. 이렇게 하면 부모 `Page`에서 버튼을 클릭할 때 댓글 목록을 스크롤하고 입력 필드에 초점을 맞출 수 있습니다.
176
176
177
177
<Sandpack>
178
178
@@ -287,5 +287,5 @@ export default AddComment;
287
287
288
288
**Ref를 과도하게 사용하지 마세요.** Ref는 Props로 표현할 수 없는 필수적인 행동에만 사용해야 합니다. 예를 들어 특정 노드로 스크롤 하기, 노드에 초점 맞추기, 애니메이션 실행하기, 텍스트 선택하기 등이 있습니다.
289
289
290
-
**Prop으로 표현할 수 있는 것에 Ref를 사용하지 마세요.** 예를 들어 `Modal` 컴포넌트에서 `{ open, close }`와 같은 Imperative Handle을 노출하는 대신 `<Modal isOpen={isOpen} />`과 같은 `isOpen` Prop을 사용하는 것이 더 좋습니다. [Effect](/learn/synchronizing-with-effects)를 사용하면 Prop을 통해 명령형 동작<sup>Imperative Behavior</sup>을 노출할 수 있습니다.
290
+
**Prop으로 표현할 수 있는 것에 Ref를 사용하지 마세요.** 예를 들어 `Modal` 컴포넌트에서 `{ open, close }`와 같은 명령형 핸들<sup>Imperative Handle</sup>을 노출하는 대신 `<Modal isOpen={isOpen} />`과 같은 `isOpen` Prop을 사용하는 것이 더 좋습니다. [Effect](/learn/synchronizing-with-effects)를 사용하면 Prop을 통해 명령형 동작<sup>Imperative Behavior</sup>을 노출할 수 있습니다.
0 commit comments