diff --git a/src/content/reference/react/Activity.md b/src/content/reference/react/Activity.md index a3c122fa5..50b7c516e 100644 --- a/src/content/reference/react/Activity.md +++ b/src/content/reference/react/Activity.md @@ -4,7 +4,7 @@ title: -`` lets you hide and restore the UI and internal state of its children. +``를 사용하면 자식 컴포넌트의 UI와 내부 상태를 숨기고 복원할 수 있습니다. ```js @@ -22,7 +22,7 @@ title: ### `` {/*activity*/} -You can use Activity to hide part of your application: +Activity를 사용하여 애플리케이션의 일부를 숨길 수 있습니다. ```js [[1, 1, "\\"hidden\\""], [2, 2, ""], [3, 1, "\\"visible\\""]] @@ -30,33 +30,33 @@ You can use Activity to hide part of your application: ``` -When an Activity boundary is hidden, React will visually hide its children using the `display: "none"` CSS property. It will also destroy their Effects, cleaning up any active subscriptions. +Activity 경계가 숨겨지면, React는 `display: "none"` CSS 프로퍼티를 사용해 자식 컴포넌트를 시각적으로 숨깁니다. 또한 Effect를 클린업하고 활성 구독을 모두 해제합니다. -While hidden, children still re-render in response to new props, albeit at a lower priority than the rest of the content. +숨겨진 상태에서도 자식 컴포넌트는 새로운 props에 반응하여 리렌더링되지만, 나머지 콘텐츠보다 낮은 우선순위로 처리됩니다. -When the boundary becomes visible again, React will reveal the children with their previous state restored, and re-create their Effects. +경계가 다시 보이게 되면, React는 이전 상태를 복원한 상태로 자식 컴포넌트를 표시하고 Effect를 다시 생성합니다. -In this way, Activity can be thought of as a mechanism for rendering "background activity". Rather than completely discarding content that's likely to become visible again, you can use Activity to maintain and restore that content's UI and internal state, while ensuring that your hidden content has no unwanted side effects. +이러한 방식으로 Activity는 "백그라운드 작업"을 렌더링하는 메커니즘으로 생각할 수 있습니다. 다시 표시될 가능성이 있는 콘텐츠를 완전히 삭제하는 대신, Activity를 사용하면 해당 콘텐츠의 UI와 내부 상태를 유지하고 복원할 수 있으며, 동시에 숨겨진 콘텐츠가 원치 않는 부작용을 일으키지 않도록 보장합니다. -[See more examples below.](#usage) +[아래에서 더 많은 예시를 확인하세요.](#usage) #### Props {/*props*/} -* `children`: The UI you intend to show and hide. -* `mode`: A string value of either `'visible'` or `'hidden'`. If omitted, defaults to `'visible'`. +* `children`: 표시하거나 숨길 UI입니다. +* `mode`: `'visible'` 또는 `'hidden'` 중 하나의 문자열 값입니다. 생략하면 기본값은 `'visible'`입니다. #### 주의 사항 {/*caveats*/} -- If an Activity is rendered inside of a [ViewTransition](/reference/react/ViewTransition), and it becomes visible as a result of an update caused by [startTransition](/reference/react/startTransition), it will activate the ViewTransition's `enter` animation. If it becomes hidden, it will activate its `exit` animation. -- An Activity that just renders text will not render anything rather than rendering hidden text, because there’s no corresponding DOM element to apply visibility changes to. For example, `` will not produce any output in the DOM for `const ComponentThatJustReturnsText = () => "Hello, World!"`. +- Activity가 [ViewTransition](/reference/react/ViewTransition) 내부에서 렌더링되고, [startTransition](/reference/react/startTransition)으로 인한 업데이트의 결과로 보이게 되면 ViewTransition의 `enter` 애니메이션이 활성화됩니다. 숨겨지면 `exit` 애니메이션이 활성화됩니다. +- 텍스트만 렌더링하는 Activity는 아무것도 렌더링하지 않습니다. 가시성 변경을 적용할 대응하는 DOM 엘리먼트가 없기 때문입니다. 예를 들어 `const ComponentThatJustReturnsText = () => "Hello, World!"`인 경우, ``는 DOM에 아무런 출력도 생성하지 않습니다. --- ## 사용법 {/*usage*/} -### Restoring the state of hidden components {/*restoring-the-state-of-hidden-components*/} +### 숨겨진 컴포넌트의 상태 복원하기 {/*restoring-the-state-of-hidden-components*/} -In React, when you want to conditionally show or hide a component, you typically mount or unmount it based on that condition: +React에서 컴포넌트를 조건부로 표시하거나 숨기려면 일반적으로 해당 조건에 따라 마운트하거나 마운트 해제합니다. ```jsx {isShowingSidebar && ( @@ -64,9 +64,9 @@ In React, when you want to conditionally show or hide a component, you typically )} ``` -But unmounting a component destroys its internal state, which is not always what you want. +하지만 컴포넌트를 마운트 해제하면 내부 상태가 사라지는데, 이것이 항상 원하는 동작은 아닙니다. -When you hide a component using an Activity boundary instead, React will "save" its state for later: +Activity 경계를 사용해 컴포넌트를 숨기면 React는 나중을 위해 상태를 "저장"합니다. ```jsx @@ -74,11 +74,11 @@ When you hide a component using an Activity boundary instead, React will "save" ``` -This makes it possible to hide and then later restore components in the state they were previously in. +이렇게 하면 컴포넌트를 숨긴 후 나중에 이전 상태 그대로 복원할 수 있습니다. -The following example has a sidebar with an expandable section. You can press "Overview" to reveal the three subitems below it. The main app area also has a button that hides and shows the sidebar. +다음 예시에는 펼칠 수 있는 섹션이 있는 사이드바가 있습니다. "Overview"를 누르면 아래에 세 개의 하위 항목이 표시됩니다. 메인 앱 영역에는 사이드바를 숨기고 표시하는 버튼도 있습니다. -Try expanding the Overview section, and then toggling the sidebar closed then open: +Overview 섹션을 펼친 다음 사이드바를 닫았다가 다시 열어보세요. @@ -167,11 +167,11 @@ h1 { -The Overview section always starts out collapsed. Because we unmount the sidebar when `isShowingSidebar` flips to `false`, all its internal state is lost. +Overview 섹션은 항상 접힌 상태로 시작합니다. `isShowingSidebar`가 `false`로 바뀌면서 사이드바를 마운트 해제하기 때문에 모든 내부 상태가 손실됩니다. -This is a perfect use case for Activity. We can preserve the internal state of our sidebar, even when visually hiding it. +이것이 바로 Activity를 사용하기 완벽한 사례입니다. 시각적으로 숨기면서도 사이드바의 내부 상태를 보존할 수 있습니다. -Let's replace the conditional rendering of our sidebar with an Activity boundary: +사이드바의 조건부 렌더링을 Activity 경계로 교체해보겠습니다. ```jsx {7,9} // Before @@ -185,7 +185,7 @@ Let's replace the conditional rendering of our sidebar with an Activity boundary ``` -and check out the new behavior: +새로운 동작을 확인해보세요. @@ -275,15 +275,15 @@ h1 { -Our sidebar's internal state is now restored, without any changes to its implementation. +이제 사이드바의 내부 상태가 구현을 변경하지 않고도 복원됩니다. --- -### Restoring the DOM of hidden components {/*restoring-the-dom-of-hidden-components*/} +### 숨겨진 컴포넌트의 DOM 복원하기 {/*restoring-the-dom-of-hidden-components*/} -Since Activity boundaries hide their children using `display: none`, their children's DOM is also preserved when hidden. This makes them great for maintaining ephemeral state in parts of the UI that the user is likely to interact with again. +Activity 경계는 `display: none`을 사용해 자식 컴포넌트를 숨기기 때문에, 숨겨진 상태에서도 자식의 DOM이 보존됩니다. 이는 사용자가 다시 상호작용할 가능성이 있는 UI 부분의 임시 상태를 유지하는 데 유용합니다. -In this example, the Contact tab has a `