diff --git a/src/content/blog/2026/09/09/react-19-3.md b/src/content/blog/2026/09/09/react-19-3.md index ed6857732..b9cd74ba3 100644 --- a/src/content/blog/2026/09/09/react-19-3.md +++ b/src/content/blog/2026/09/09/react-19-3.md @@ -1,36 +1,36 @@ --- title: "React 19.3" -author: The React Team +author: React 팀 date: 2026/09/09 -description: React 19.3 adds new features like View Transitions, Fragment Refs, browser(), Trusted Types, and more. +description: React 19.3에는 View Transitions, Fragment Refs, browser(), Trusted Types 등의 새로운 기능이 추가되었습니다. --- -September 9, 2026 by [The React Team](/community/team) +2026년 9월 9일, [React 팀](/community/team) --- -React 19.3 is now available on npm! +React 19.3이 npm에 공개되었습니다! -[Last year](/blog/2025/04/23/react-labs-view-transitions-activity-and-more), we shared View Transitions and Fragment Refs as new experimental APIs coming to React. We're excited to announce that both of these are now stable in React 19.3! +[작년](/blog/2025/04/23/react-labs-view-transitions-activity-and-more)에 React에 새로 추가될 실험적 API로 View Transitions와 Fragment Refs를 소개했습니다. 이제 두 기능 모두 React 19.3에서 안정 버전이 되었음을 발표하게 되어 기쁩니다! -In this post, we'll go over how they work, and also cover some other notable changes in this release. +이 글에서는 두 기능이 어떻게 동작하는지 살펴보고, 이번 릴리스의 다른 주목할 만한 변경 사항도 다룹니다. --- -## New React Features {/*new-react-features*/} +## 새로운 React 기능 {/*new-react-features*/} ### View Transitions {/*view-transition*/} -The new `` component lets you animate elements as they enter, exit, move, or resize using the browser's [View Transition API](https://developer.mozilla.org/en-US/docs/Web/API/View_Transition_API). We shared it as an experimental API [last year](/blog/2025/04/23/react-labs-view-transitions-activity-and-more#view-transitions), and in 19.3 it's stable and ready to use. +새로운 `` 컴포넌트를 사용하면 브라우저의 [View Transition API](https://developer.mozilla.org/ko/docs/Web/API/View_Transition_API)를 이용해 엘리먼트가 나타나거나, 사라지거나, 이동하거나, 크기가 바뀔 때 애니메이션을 적용할 수 있습니다. [작년](/blog/2025/04/23/react-labs-view-transitions-activity-and-more#view-transitions)에 실험적 API로 소개했으며, 19.3에서 안정 버전이 되어 바로 사용할 수 있습니다. -To animate part of your UI, wrap it in ``: +UI의 일부에 애니메이션을 적용하려면 ``으로 감싸세요. ```js import { ViewTransition } from 'react'; @@ -42,22 +42,22 @@ import { ViewTransition } from 'react'; )} ``` -Now, whenever an update marked as a [Transition](/reference/react/useTransition) changes the child component's style, or causes the `ViewTransition` to be mounted or unmounted, React will animate that update. +이제 [Transition](/reference/react/useTransition)으로 표시된 업데이트가 자식 컴포넌트의 스타일을 바꾸거나 `ViewTransition`을 마운트 또는 마운트 해제할 때마다 React가 그 업데이트에 애니메이션을 적용합니다. {/* Updates outside of a Transition don't trigger animations, as those are meant to be urgent and reflected immediately in the UI. State updates inside of [startTransition](/reference/react/startTransition), a [``](/reference/react/Suspense) reveal, or an update from [`useDeferredValue`](/reference/react/useDeferredValue) all cause a View Transition to animate. */} -React chooses which animation to run based on how the tree changed: +React는 트리가 어떻게 바뀌었는지에 따라 실행할 애니메이션을 선택합니다. -- **enter**: the `` is added. -- **exit**: the `` is removed. -- **update**: the children of a `` change style or content. -- **share**: a named `` is removed in one place and added in another. +- **enter**: ``이 추가됩니다. +- **exit**: ``이 제거됩니다. +- **update**: ``의 자식이 스타일이나 콘텐츠를 바꿉니다. +- **share**: 이름이 지정된 ``이 한 곳에서 제거되고 다른 곳에 추가됩니다. -Note that updates not marked as Transitions don't trigger animations, as those are meant to be urgent and reflected immediately in the UI. State updates inside of [startTransition](/reference/react/startTransition), a [``](/reference/react/Suspense) reveal, or an update from [`useDeferredValue`](/reference/react/useDeferredValue) all cause a View Transition to animate. +Transition으로 표시되지 않은 업데이트는 긴급하며 UI에 즉시 반영되어야 하므로 애니메이션을 일으키지 않는다는 점에 유의하세요. [startTransition](/reference/react/startTransition) 내부의 State 업데이트, [``](/reference/react/Suspense)의 콘텐츠 표시, [`useDeferredValue`](/reference/react/useDeferredValue)로 인한 업데이트는 모두 View Transition 애니메이션을 일으킵니다. -Here's a simple example of an enter/exit animation: +다음은 간단한 enter/exit 애니메이션 예시입니다. @@ -220,23 +220,23 @@ button:hover { -By default, `` animates with a smooth cross-fade. You can customize each kind of animation by passing a [View Transition Class](/reference/react/ViewTransition#view-transition-class) and defining the animation in CSS, or you can use the [Web Animations API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Animations_API) to trigger animations imperatively with the [event props](/reference/react/ViewTransition#view-transition-event) (`onEnter`, `onExit`, `onShare`, `onUpdate`). +기본적으로 ``은 부드러운 크로스 페이드로 애니메이션합니다. [View Transition 클래스](/reference/react/ViewTransition#view-transition-class)를 전달하고 CSS로 애니메이션을 정의해 애니메이션 종류별로 직접 설정하거나, [이벤트 Props](/reference/react/ViewTransition#view-transition-event)(`onEnter`, `onExit`, `onShare`, `onUpdate`)와 [Web Animations API](https://developer.mozilla.org/ko/docs/Web/API/Web_Animations_API)를 사용해 명령형으로 애니메이션을 실행할 수 있습니다. {/* There are a couple of rules to keep in mind. A `` only animates on enter and exit if it's the first thing rendered in its subtree, before any DOM node, and each shared `name` must be unique across your app at any given time. See [Troubleshooting](/reference/react/ViewTransition#troubleshooting) for the details. */} -Currently, `` only works in the DOM. We're working on support for React Native and other platforms. +현재 ``은 DOM에서만 동작합니다. React Native와 다른 플랫폼 지원도 작업 중입니다. -For more, see the [`` docs](/reference/react/ViewTransition). +자세한 내용은 [`` 문서](/reference/react/ViewTransition)를 참고하세요. --- #### `addTransitionType` {/*add-transition-type*/} -Sometimes, you'll want to customize which animation is used for the same state update. For example, navigating a carousel _forward_ to the third slide should animate the slides right-to-left, while navigating it _backward_ should animate them left-to-right, even though both actions set the currentSlide to 3. +같은 State 업데이트라도 사용할 애니메이션을 다르게 설정하고 싶을 때가 있습니다. 예를 들어 캐러셀에서 세 번째 슬라이드로 _앞으로_ 이동할 때는 슬라이드가 오른쪽에서 왼쪽으로 움직이고, _뒤로_ 이동할 때는 왼쪽에서 오른쪽으로 움직여야 합니다. 두 동작 모두 currentSlide를 3으로 설정하는데도 말입니다. -You can customize the animation for a given View Transition by calling `addTransitionType` alongside the state update. This lets you add more information about the _cause_ of a particular transition: +State 업데이트와 함께 `addTransitionType`을 호출하면 특정 View Transition의 애니메이션을 설정할 수 있습니다. 이를 통해 특정 Transition이 일어난 _원인_에 대한 정보를 더할 수 있습니다. ```js {3,10} function nextSlide() { @@ -254,7 +254,7 @@ function previousSlide() { } ``` -Then, you can specify different animations based on that transition type: +그런 다음 해당 Transition 타입에 따라 서로 다른 애니메이션을 지정할 수 있습니다. ```js ``` -Here's an example: +다음은 예시입니다. @@ -555,17 +555,17 @@ button:hover { -React also adds every Transition Type to the element as a browser [view transition type](https://www.w3.org/TR/css-view-transitions-2/#active-view-transition-pseudo-examples), so you can scope animations in CSS with `:active-view-transition-type(...)`. +React는 모든 Transition 타입을 브라우저의 [view transition type](https://www.w3.org/TR/css-view-transitions-2/#active-view-transition-pseudo-examples)으로도 엘리먼트에 추가하므로 CSS에서 `:active-view-transition-type(...)`으로 애니메이션 범위를 지정할 수 있습니다. -To learn more, see the [`addTransitionType` docs](/reference/react/addTransitionType). +자세한 내용은 [`addTransitionType` 문서](/reference/react/addTransitionType)를 참고하세요. --- -#### Animating fallbacks, images, and fonts with Suspense {/*animating-fallbacks-images-and-fonts-with-suspense*/} +#### Suspense로 Fallback, 이미지, 폰트에 애니메이션 적용하기 {/*animating-fallbacks-images-and-fonts-with-suspense*/} -One of the most exciting things about View Transitions in React is how they integrate with Suspense. +React View Transitions에서 가장 흥미로운 점 중 하나는 Suspense와 통합된다는 것입니다. -You can animate a Suspense boundary as it reveals its children by wrapping it in ``: +Suspense 경계를 ``으로 감싸면 자식을 보여줄 때 애니메이션을 적용할 수 있습니다. ```js @@ -575,9 +575,9 @@ You can animate a Suspense boundary as it reveals its children by wrapping it in ``` -When the children finish loading, React will trigger an **update** animation from the fallback to the final content. +자식의 로딩이 끝나면 React는 Fallback에서 최종 콘텐츠로 바뀌는 **update** 애니메이션을 실행합니다. -Here's an example. Try pressing ➕ to render a LazyVideo that suspends the first time it's rendered: +다음은 예시입니다. ➕를 눌러 처음 렌더링될 때 지연되는 LazyVideo를 렌더링해 보세요. @@ -806,19 +806,19 @@ button:hover { -While this works, you'll notice that the video also animates in and out on subsequent reveals, even though it's already been loaded. (You might also notice that the fallback fades in the first time it's shown.) +이 방식도 동작하지만, 영상이 이미 로드된 뒤에도 다시 보여줄 때마다 영상이 나타나고 사라지는 애니메이션이 실행된다는 것을 알 수 있습니다. (Fallback이 처음 표시될 때 페이드 인되는 것도 눈치챘을 수 있습니다.) -In general, animations with Suspense work best when they're used sparingly, and avoided for cached UI that would otherwise appear instantly. +일반적으로 Suspense 애니메이션은 꼭 필요한 곳에만 사용하고, 원래라면 즉시 나타날 캐시된 UI에는 사용하지 않는 것이 가장 좋습니다. -Here are some principles for achieving good UX when animating with Suspense: +Suspense와 함께 애니메이션을 적용할 때 좋은 UX를 위한 몇 가지 원칙은 다음과 같습니다. -- Fallbacks should appear immediately _without animation_ -- A fallback should update to its final content _with animation_ -- Children that don't suspend should appear immediately _without animation_ +- Fallback은 _애니메이션 없이_ 즉시 나타나야 합니다. +- Fallback은 _애니메이션과 함께_ 최종 콘텐츠로 바뀌어야 합니다. +- 지연되지 않는 자식은 _애니메이션 없이_ 즉시 나타나야 합니다. -This keeps your app feeling snappy when things are already loaded, and only uses animation to make the update from fallback to final content more seamless. +이렇게 하면 이미 로드된 경우에는 앱이 빠르게 반응하고, Fallback에서 최종 콘텐츠로 바뀌는 순간에만 애니메이션을 사용해 전환을 더 매끄럽게 만들 수 있습니다. -To fix our example above, we can disable all animations other than updates: +위 예시를 고치려면 update를 제외한 모든 애니메이션을 끄면 됩니다. ```js {1} @@ -828,7 +828,7 @@ To fix our example above, we can disable all animations other than updates: ``` -Let's see how it behaves now: +이제 어떻게 동작하는지 확인해 보겠습니다. @@ -1057,17 +1057,17 @@ button:hover { -Notice how the fallback appears immediately when tapping the button, which keeps our UI feeling responsive to user actions. Additionally, once the video has been loaded, toggling it is instant. +버튼을 누르면 Fallback이 즉시 나타나므로 UI가 사용자 동작에 빠르게 반응한다는 느낌을 줍니다. 또한 영상이 한 번 로드된 후에는 토글이 즉시 이루어집니다. -There are other patterns you can use depending on what effect you want to achieve. To learn more, check out the docs on [animating with Suspense](/reference/react/ViewTransition#animating-from-suspense-content). +원하는 효과에 따라 사용할 수 있는 다른 패턴도 있습니다. 자세한 내용은 [Suspense와 함께 애니메이션 적용하기](/reference/react/ViewTransition#animating-from-suspense-content) 문서를 참고하세요. --- -In addition to animating fallbacks, View Transitions act as a way to opt images or fonts into triggering Suspense while they load. +View Transitions는 Fallback에 애니메이션을 적용하는 것 외에도, 이미지나 폰트가 로드되는 동안 Suspense를 일으키도록 선택하는 방법이 되기도 합니다. -This lets you avoid the browser's default behavior where images or fonts may flicker in whenever they happen to finish loading, and instead build coordinated loading sequences that consider all of a component's resources. +이렇게 하면 이미지나 폰트가 로드가 끝나는 대로 깜빡이며 나타나는 브라우저의 기본 동작을 피하고, 컴포넌트의 모든 리소스를 고려한 조율된 로딩 순서를 만들 수 있습니다. -Wrap images or fonts inside of `` to trigger Suspense while they load: +이미지나 폰트가 로드되는 동안 Suspense를 일으키려면 ``으로 감싸세요. ```js @@ -1085,7 +1085,7 @@ Wrap images or fonts inside of `` to trigger Suspense while they ``` -Here's an example of a component that suspends until its data, image, and font have all loaded: +다음은 데이터, 이미지, 폰트가 모두 로드될 때까지 지연되는 컴포넌트 예시입니다. @@ -1310,16 +1310,16 @@ img { -To learn more about waiting for images, fonts, or stylesheets to load, see the [Suspense docs](/reference/react/Suspense#waiting-for-a-font-to-load). +이미지, 폰트, 스타일시트 로딩을 기다리는 방법에 대한 자세한 내용은 [Suspense 문서](/reference/react/Suspense#waiting-for-a-font-to-load)를 참고하세요. --- ### Fragment Refs {/*fragment-refs*/} -When you need lower-level control over a component's DOM nodes—for example to attach an event listener, observe visibility, or move focus—you can usually use a ref. But there are some situations where this is difficult: +이벤트 리스너를 연결하거나, 화면 노출 여부를 관찰하거나, 포커스를 옮기는 등 컴포넌트의 DOM 노드를 저수준에서 제어해야 할 때는 보통 ref를 사용할 수 있습니다. 하지만 다음과 같이 ref를 쓰기 어려운 상황도 있습니다. -- Components that render a group of siblings with no single parent -- Components that don't pass along their `ref` prop to another element +- 단일 부모 없이 여러 형제 요소를 렌더링하는 컴포넌트 +- `ref` Prop을 다른 엘리먼트에 전달하지 않는 컴포넌트 ```js function Component() { @@ -1334,11 +1334,11 @@ function Component() { } ``` -Adding a wrapper `
` just to hold a ref sometimes works, but it can also interfere with your component's styling or layout. Moreover, if a component doesn't expose a `ref` prop, you would need to modify that component to do so, which might be impossible if it comes from a library you don't control. +ref를 달기 위해 래퍼 `
`를 추가하는 방법이 통할 때도 있지만, 컴포넌트의 스타일이나 레이아웃에 영향을 줄 수 있습니다. 게다가 컴포넌트가 `ref` Prop을 노출하지 않는다면 그렇게 하도록 컴포넌트를 수정해야 하는데, 직접 관리하지 않는 라이브러리의 컴포넌트라면 불가능할 수도 있습니다. -Fragment Refs solve these problems by providing a limited set of commonly used DOM methods that work with any React component, regardless of what it renders. +Fragment Refs는 무엇을 렌더링하든 모든 React 컴포넌트에서 동작하는, 자주 쓰이는 DOM 메서드의 제한된 집합을 제공해 이 문제를 해결합니다. -In 19.3, you can use them by passing a ref directly to a [``](/reference/react/Fragment). This ref gives you a `FragmentInstance`, which you can use to work with the Fragment's DOM children: +19.3에서는 [``](/reference/react/Fragment)에 ref를 직접 전달해 사용할 수 있습니다. 이 ref는 `FragmentInstance`를 제공하며, 이를 통해 Fragment의 DOM 자식을 다룰 수 있습니다. ```js {2,5-6,10} function Component() { @@ -1361,16 +1361,16 @@ function Component() { } ``` -The `FragmentInstance` operates on the children's DOM _as a group_, without changing its structure: +`FragmentInstance`는 자식의 DOM 구조를 바꾸지 않고 자식의 DOM을 _하나의 그룹으로_ 다룹니다. -- `addEventListener`, `removeEventListener`, and `dispatchEvent` manage events for first-level children. -- `focus`, `focusLast`, and `blur` move focus across nested children, depth-first. -- `observeUsing` and `unobserveUsing` connect an `IntersectionObserver` or `ResizeObserver`. -- `getClientRects`, `getRootNode`, `compareDocumentPosition`, and `scrollIntoView` let you measure and scroll to the fragment's first-level children. +- `addEventListener`, `removeEventListener`, `dispatchEvent`는 첫 번째 레벨 자식의 이벤트를 관리합니다. +- `focus`, `focusLast`, `blur`는 중첩된 자식 사이에서 깊이 우선으로 포커스를 이동합니다. +- `observeUsing`과 `unobserveUsing`은 `IntersectionObserver`나 `ResizeObserver`를 연결합니다. +- `getClientRects`, `getRootNode`, `compareDocumentPosition`, `scrollIntoView`로 Fragment의 첫 번째 레벨 자식을 측정하고 스크롤할 수 있습니다. -Thus, Fragment Refs let you attach behavior to other components without requiring you to modify those component's internals, or without changing the DOM structure that they already produce. +따라서 Fragment Refs를 사용하면 다른 컴포넌트의 내부를 수정하거나 이미 만들어 내는 DOM 구조를 바꾸지 않고도 그 컴포넌트에 동작을 붙일 수 있습니다. -This example shows an `InView` component with an `onChange` prop that fires whenever its children enter or exit the viewport: +이 예시는 자식이 뷰포트에 들어오거나 나갈 때마다 실행되는 `onChange` Prop을 가진 `InView` 컴포넌트를 보여줍니다. @@ -1485,26 +1485,26 @@ export default function InView({ onChange, children }) { -Notice how `InView` is able to add behavior to its children, even though there's no single parent DOM element, and in spite of `Card` not exposing a `ref` prop. +단일 부모 DOM 엘리먼트가 없고 `Card`가 `ref` Prop을 노출하지 않는데도 `InView`가 자식에 동작을 추가할 수 있다는 점에 주목하세요. -To learn more about working with Fragment Refs, see the [`` docs](/reference/react/Fragment). +Fragment Refs 사용법에 대한 자세한 내용은 [`` 문서](/reference/react/Fragment)를 참고하세요. --- -## New React DOM Features {/*new-react-dom-features*/} +## 새로운 React DOM 기능 {/*new-react-dom-features*/} ### `browser` {/*browser*/} -If your app uses server rendering, your components will render in two different environments: +앱이 서버 렌더링을 사용한다면 컴포넌트는 서로 다른 두 환경에서 렌더링됩니다. -- On the server, components render to produce the initial HTML -- On the client, components render to enrich that HTML with event handlers +- 서버에서는 초기 HTML을 만들기 위해 컴포넌트를 렌더링합니다. +- 클라이언트에서는 그 HTML에 이벤트 핸들러를 연결하기 위해 컴포넌트를 렌더링합니다. -Most of time, your components should be able to produce HTML that matches their initial client-rendered output, ensuring they hydrate correctly while still letting users see as much content as possible on the initial load. +대부분의 경우 컴포넌트는 클라이언트의 첫 렌더링 결과와 일치하는 HTML을 만들 수 있어야 합니다. 그래야 올바르게 Hydration되면서도 사용자가 첫 로딩에서 최대한 많은 콘텐츠를 볼 수 있습니다. -But in rare cases, a component may not be able to produce meaningful UI on the server. For example, it might depend on a browser-only API like `localStorage`, or it might read from the browser's local timezone. In these cases, you may want to opt that component out of server rendering altogether. +하지만 드물게 컴포넌트가 서버에서 의미 있는 UI를 만들 수 없는 경우가 있습니다. 예를 들어 `localStorage` 같은 브라우저 전용 API에 의존하거나, 브라우저의 로컬 시간대를 읽을 수도 있습니다. 이런 경우에는 해당 컴포넌트를 서버 렌더링에서 아예 제외하고 싶을 수 있습니다. -Previously, you might do this using some state that you'd update in an effect, or by checking for the presence of browser APIs like `window`: +이전에는 Effect에서 업데이트하는 State를 사용하거나 `window` 같은 브라우저 API가 있는지 확인하는 방법을 썼을 것입니다. ```js function Component() { @@ -1524,9 +1524,9 @@ function Component() { } ``` -In 19.3, React now includes a first-class API for this technique. +19.3부터 React는 이 기법을 위한 정식 API를 제공합니다. -A component can call `use(browser())` to opt out of server-side rendering: +컴포넌트는 `use(browser())`를 호출해 서버 사이드 렌더링에서 제외될 수 있습니다. ```js {5} import { use } from 'react'; @@ -1539,9 +1539,9 @@ function Component() { } ``` -This will trigger Suspense on the server, but _not_ in the client. During server-side rendering, the nearest Suspense boundary's fallback will show in the HTML. Once the component is hydrated on the client, `use(browser())` does not suspend, allowing the component to continue rendering as normal. +이렇게 하면 서버에서는 Suspense가 일어나지만, 클라이언트에서는 _일어나지 않습니다_. 서버 사이드 렌더링 중에는 가장 가까운 Suspense 경계의 Fallback이 HTML에 표시됩니다. 컴포넌트가 클라이언트에서 Hydration되면 `use(browser())`는 지연되지 않으므로 컴포넌트가 평소처럼 렌더링을 계속할 수 있습니다. -Here's an example of a component that renders the local time zone from your device. Press **Reload** to see the initial HTML followed by React's first render on the client: +다음은 기기의 로컬 시간대를 렌더링하는 컴포넌트 예시입니다. **Reload**를 눌러 초기 HTML이 표시된 다음 클라이언트에서 React가 처음 렌더링하는 과정을 확인해 보세요. @@ -1660,15 +1660,15 @@ iframe { -Because TimeZone suspends on the server, the initial HTML includes the Suspense fallback. After a small artificial delay, React hydrates the page, allowing the component to render as normal in the browser. +TimeZone은 서버에서 지연되므로 초기 HTML에는 Suspense Fallback이 포함됩니다. 약간의 인위적인 지연 후 React가 페이지를 Hydration하면 컴포넌트가 브라우저에서 평소처럼 렌더링됩니다. -Thus, for components that cannot produce meaningful UI during server rendering, `browser` lets you use Suspense for their loading states, allowing them to participate with other components that suspend until they're ready to render. +따라서 서버 렌더링 중에 의미 있는 UI를 만들 수 없는 컴포넌트에서 `browser`를 사용하면 로딩 상태에 Suspense를 활용할 수 있고, 렌더링할 준비가 될 때까지 지연되는 다른 컴포넌트와 함께 동작하도록 만들 수 있습니다. --- -Like other calls to `use`, `use(browser())` can be called inside a conditional statement or after an early return. This lets you write components or custom Hooks that can opt out of server rendering based on a condition, such as the value of a prop. +다른 `use` 호출과 마찬가지로 `use(browser())`는 조건문 안이나 조기 반환 뒤에서도 호출할 수 있습니다. 덕분에 Prop의 값 같은 조건에 따라 서버 렌더링에서 제외되는 컴포넌트나 커스텀 Hook을 작성할 수 있습니다. -Here's the same example from above, except now our TimeZone component accepts an optional default value it can render as part of the initial HTML: +다음은 위와 같은 예시인데, 이번에는 TimeZone 컴포넌트가 초기 HTML에 렌더링할 수 있는 기본값을 선택적으로 받습니다. @@ -1800,9 +1800,9 @@ iframe { -Notice how TimeZone only suspends in the second case, when no default is provided. +기본값이 주어지지 않은 두 번째 경우에만 TimeZone이 지연된다는 점에 주목하세요. -Another useful example of this pattern is opting a data-fetching Hook like `useQuery` out of server rendering, unless that query's initial data was passed in (for example from a Server Component or framework's loader function): +이 패턴의 또 다른 유용한 예는 `useQuery` 같은 데이터 가져오기 Hook을 서버 렌더링에서 제외하되, (서버 컴포넌트나 프레임워크의 로더 함수 등에서) 쿼리의 초기 데이터가 전달된 경우에는 제외하지 않는 것입니다. ```js {3} function useBrowserQuery(query, options) { @@ -1822,27 +1822,27 @@ function ProductDetails({ productId, initialData }) { } ``` -Now, the ProductDetails component can be included in the HTML, provided it receives `initialData` during server rendering. If not, it suspends until it gets rendered in the browser, at which point `useQuery` can fetch the data or read from its cache as normal. +이제 ProductDetails 컴포넌트는 서버 렌더링 중에 `initialData`를 받으면 HTML에 포함될 수 있습니다. 그렇지 않으면 브라우저에서 렌더링될 때까지 지연되며, 그때 `useQuery`가 평소처럼 데이터를 가져오거나 캐시에서 읽을 수 있습니다. -To learn more about `browser`, [check out the docs](/reference/react-dom/browser). +`browser`에 대해 더 알아보려면 [문서를 확인하세요](/reference/react-dom/browser). --- -### Trusted Types support {/*trusted-types-support*/} +### Trusted Types 지원 {/*trusted-types-support*/} -React 19.3 integrates with the browser [Trusted Types API](https://developer.mozilla.org/en-US/docs/Web/API/Trusted_Types_API), a security feature that helps prevent DOM-based XSS attacks. When a site enforces Trusted Types with `Content-Security-Policy: require-trusted-types-for 'script'`, the browser requires that values passed to injection sinks like `innerHTML` are typed objects (`TrustedHTML`, `TrustedScript`, `TrustedScriptURL`) created through your sanitization policies, rather than raw strings. +React 19.3은 DOM 기반 XSS 공격을 막는 데 도움이 되는 보안 기능인 브라우저의 [Trusted Types API](https://developer.mozilla.org/ko/docs/Web/API/Trusted_Types_API)와 통합됩니다. 사이트가 `Content-Security-Policy: require-trusted-types-for 'script'`로 Trusted Types를 강제하면, 브라우저는 `innerHTML` 같은 주입 지점Injection Sink에 전달되는 값이 일반 문자열이 아니라 정제 정책을 통해 만든 타입 객체(`TrustedHTML`, `TrustedScript`, `TrustedScriptURL`)이기를 요구합니다. -Previously, React always coerced values to strings (via `'' + value`) before passing them to DOM APIs, which turned Trusted Types objects back into plain strings the browser would reject. React now passes these values through without coercion, so the browser can validate them and your Trusted Types policies work as intended. +이전에는 React가 DOM API에 값을 전달하기 전에 항상 (`'' + value`로) 문자열로 변환했기 때문에, Trusted Types 객체가 브라우저가 거부하는 일반 문자열로 되돌아갔습니다. 이제 React는 이런 값을 변환 없이 그대로 전달하므로 브라우저가 값을 검증할 수 있고 Trusted Types 정책이 의도대로 동작합니다. --- -## New React Server Components Features {/*new-react-server-components-features*/} +## 새로운 React 서버 컴포넌트 기능 {/*new-react-server-components-features*/} -### `` can be rendered directly in Server Components {/*context-can-be-rendered-directly-in-server-components*/} +### 서버 컴포넌트에서 ``를 직접 렌더링할 수 있습니다 {/*context-can-be-rendered-directly-in-server-components*/} -While Server Components can't _create_ Context, they can _render_ Context by importing it from a `'use client'` module. +서버 컴포넌트는 Context를 _생성_할 수는 없지만, `'use client'` 모듈에서 불러와 _렌더링_할 수는 있습니다. -Previously, this required the client module to export a separate wrapper component, often called a Provider: +이전에는 이를 위해 클라이언트 모듈이 흔히 Provider라고 부르는 별도의 래퍼 컴포넌트를 내보내야 했습니다. ```js {7-9} // user-context.js @@ -1871,9 +1871,9 @@ export async function Layout({ children }) { } ``` -Notice that in this example, the provider does nothing other than pass the prop from the Server Component directly to the Context. +이 예시에서 Provider는 서버 컴포넌트에서 받은 Prop을 Context에 그대로 전달하는 것 외에는 아무것도 하지 않습니다. -In React 19.3, Server Components can import and render Context directly from a `'use client'` module, without an additional wrapping component: +React 19.3에서는 서버 컴포넌트가 추가 래퍼 컴포넌트 없이 `'use client'` 모듈에서 Context를 불러와 직접 렌더링할 수 있습니다. ```js {5} // user-context.js @@ -1898,54 +1898,54 @@ export async function Layout({ children }) { } ``` -This is especially useful for Contexts that solely exist to allow Server Components to share some data with the rest of the client tree. +이 기능은 서버 컴포넌트가 클라이언트 트리의 나머지 부분과 데이터를 공유하기 위해서만 존재하는 Context에 특히 유용합니다. --- -## Changelog {/*changelog*/} - -Other notable changes -- `react`: Render Transitions independently instead of entangling them into a single render, so a slow Transition no longer holds up unrelated ones [#37290](https://github.com/react/react/pull/37290) -- `react-dom`: Double invoke Effects in Strict Mode during hydration, matching client-rendered roots [#35961](https://github.com/react/react/pull/35961) -- `react`: Add a warning when `use` is used incorrectly in a conditional [#37104](https://github.com/react/react/pull/37104) -- `react`: Rename "form state" to "action state" in `useActionState` error messages [#35790](https://github.com/react/react/pull/35790) -- `react-dom`: Add support for `onFullscreenChange` and `onFullscreenError` events [#34621](https://github.com/react/react/pull/34621) -- `react-dom`: Add support for the `maskType` SVG property [#35921](https://github.com/react/react/pull/35921) -- `react-dom`: Support `fetchPriority` for module resources [#36835](https://github.com/react/react/pull/36835) -- `react-dom`: Fire `onReset` when React automatically resets a form after a Server Action [#35176](https://github.com/react/react/pull/35176) -- `react-dom`: Include the `submitter` in `submit` events [#35590](https://github.com/react/react/pull/35590) -- `react-dom`: Recognize `credentialless` as a boolean attribute on iframes [#36148](https://github.com/react/react/pull/36148) -- `react-dom`: Batch updates from `resize` events until the next frame [#35117](https://github.com/react/react/pull/35117) -- `react-server`: Transport `Error.cause` [#35810](https://github.com/react/react/pull/35810) and `AggregateError.errors` [#36156](https://github.com/react/react/pull/36156) to the client -- `react-server`: Add support for `` in Flight [#34697](https://github.com/react/react/pull/34697) - -Notable bug fixes - -- `react`: Fix `useDeferredValue` getting stuck on an old value [#36134](https://github.com/react/react/pull/36134) -- `react`: Fix context propagation into Suspense fallbacks [#36160](https://github.com/react/react/pull/36160) and through suspended Suspense boundaries [#35839](https://github.com/react/react/pull/35839) -- `react`: Fix a hang when updating a dehydrated Suspense boundary inside a hidden tree [#37135](https://github.com/react/react/pull/37135) -- `react`: Fix `useSyncExternalStore` missing store mutations that happened while an `` tree was hidden [#36947](https://github.com/react/react/pull/36947) -- `react`: Fix `useEffectEvent` to read the latest values in `forwardRef` and `memo` components [#34831](https://github.com/react/react/pull/34831) -- `react`: Fix form status resetting when component state is updated [#34075](https://github.com/react/react/pull/34075) -- `react`: Fix several Fast Refresh bugs with `lazy`, `memo`, and edits that change a component's kind [#36965](https://github.com/react/react/pull/36965), [#36964](https://github.com/react/react/pull/36964), [#36963](https://github.com/react/react/pull/36963), [#36950](https://github.com/react/react/pull/36950) -- `react`: Fix a bug where `` was still hoisted to `<head>` after the `<Activity>` containing the `<title>` changed mode from `visible` to `hidden` [#34983](https://github.com/react/react/pull/34983) -- `react`: Don't let errors escape a hidden `<Activity>` [#35074](https://github.com/react/react/pull/35074) -- `react`: Hide portal contents rendered inside a hidden `<Activity>` [#35091](https://github.com/react/react/pull/35091) -- `react`: Don't reference the internal `<Offscreen>` type in error messages [#35763](https://github.com/react/react/pull/35763) -- `react-dom`: Fix focus for delegated and already-focused elements [#36010](https://github.com/react/react/pull/36010) -- `react-dom`: Fix a `FragmentInstance` listener leak by normalizing capture options per the DOM spec [#36047](https://github.com/react/react/pull/36047) -- `react-dom`: Fix a `<ViewTransition>` crash in Mobile Safari [#35337](https://github.com/react/react/pull/35337) -- `react-dom`: Fix a `<ViewTransition>` crash with `SuspenseList` [#35520](https://github.com/react/react/pull/35520) -- `react-dom`: Update `defaultValue` for `type="number"` inputs to match other input types [#36980](https://github.com/react/react/pull/36980) -- `react-dom`: Avoid setting `innerHTML` when it hasn't changed [#36949](https://github.com/react/react/pull/36949) -- `react-dom`: Fix a false-positive hydration mismatch on `nonce` attributes [#37030](https://github.com/react/react/pull/37030) -- `react-dom`: Fix `react-dom/server` hanging on Deno [#35235](https://github.com/react/react/pull/35235) -- `react-server`: Fix dropped `FormData` entries in `decodeReplyFromBusboy` [#36468](https://github.com/react/react/pull/36468) -- `react-server`: Fix a stack overflow with deep async chains [#35612](https://github.com/react/react/pull/35612) and a `RangeError` from exponential debug info growth [#37481](https://github.com/react/react/pull/37481) - -For a full list of changes, please see the [Changelog](https://github.com/react/react/blob/main/CHANGELOG.md). +## 변경 로그 {/*changelog*/} + +기타 주목할 만한 변경 사항 +- `react`: Transition을 하나의 렌더링으로 묶지 않고 독립적으로 렌더링하여, 느린 Transition이 관련 없는 Transition을 더 이상 지연시키지 않음 [#37290](https://github.com/react/react/pull/37290) +- `react-dom`: 클라이언트에서 렌더링된 루트와 동일하게 Hydration 중에도 Strict Mode에서 Effect를 두 번 실행 [#35961](https://github.com/react/react/pull/35961) +- `react`: 조건문에서 `use`를 잘못 사용하면 경고 추가 [#37104](https://github.com/react/react/pull/37104) +- `react`: `useActionState` 오류 메시지의 "form state"를 "action state"로 변경 [#35790](https://github.com/react/react/pull/35790) +- `react-dom`: `onFullscreenChange`와 `onFullscreenError` 이벤트 지원 추가 [#34621](https://github.com/react/react/pull/34621) +- `react-dom`: `maskType` SVG 프로퍼티 지원 추가 [#35921](https://github.com/react/react/pull/35921) +- `react-dom`: 모듈 리소스에 `fetchPriority` 지원 [#36835](https://github.com/react/react/pull/36835) +- `react-dom`: Server Action 후 React가 폼을 자동으로 초기화할 때 `onReset` 실행 [#35176](https://github.com/react/react/pull/35176) +- `react-dom`: `submit` 이벤트에 `submitter` 포함 [#35590](https://github.com/react/react/pull/35590) +- `react-dom`: iframe의 `credentialless`를 불리언 어트리뷰트로 인식 [#36148](https://github.com/react/react/pull/36148) +- `react-dom`: `resize` 이벤트로 인한 업데이트를 다음 프레임까지 일괄 처리 [#35117](https://github.com/react/react/pull/35117) +- `react-server`: `Error.cause` [#35810](https://github.com/react/react/pull/35810)와 `AggregateError.errors` [#36156](https://github.com/react/react/pull/36156)를 클라이언트로 전송 +- `react-server`: Flight에서 `<Activity>` 지원 추가 [#34697](https://github.com/react/react/pull/34697) + +주목할 만한 버그 수정 + +- `react`: `useDeferredValue`가 이전 값에 머무는 문제 수정 [#36134](https://github.com/react/react/pull/36134) +- `react`: Suspense Fallback으로의 Context 전파 [#36160](https://github.com/react/react/pull/36160) 및 지연된 Suspense 경계를 통한 Context 전파 [#35839](https://github.com/react/react/pull/35839) 수정 +- `react`: 숨겨진 트리 안의 Dehydrated Suspense 경계를 업데이트할 때 멈추는 문제 수정 [#37135](https://github.com/react/react/pull/37135) +- `react`: `<Activity>` 트리가 숨겨져 있는 동안 일어난 스토어 변경을 `useSyncExternalStore`가 놓치는 문제 수정 [#36947](https://github.com/react/react/pull/36947) +- `react`: `forwardRef`와 `memo` 컴포넌트에서 `useEffectEvent`가 최신 값을 읽도록 수정 [#34831](https://github.com/react/react/pull/34831) +- `react`: 컴포넌트 State가 업데이트될 때 폼 상태가 초기화되는 문제 수정 [#34075](https://github.com/react/react/pull/34075) +- `react`: `lazy`, `memo`, 컴포넌트 종류를 바꾸는 수정과 관련된 여러 Fast Refresh 버그 수정 [#36965](https://github.com/react/react/pull/36965), [#36964](https://github.com/react/react/pull/36964), [#36963](https://github.com/react/react/pull/36963), [#36950](https://github.com/react/react/pull/36950) +- `react`: `<title>`을 포함한 `<Activity>`의 모드가 `visible`에서 `hidden`으로 바뀐 뒤에도 `<title>`이 `<head>`로 호이스팅되던 버그 수정 [#34983](https://github.com/react/react/pull/34983) +- `react`: 숨겨진 `<Activity>` 밖으로 오류가 빠져나가지 않도록 수정 [#35074](https://github.com/react/react/pull/35074) +- `react`: 숨겨진 `<Activity>` 안에서 렌더링된 포털 콘텐츠 숨김 [#35091](https://github.com/react/react/pull/35091) +- `react`: 오류 메시지에서 내부 `<Offscreen>` 타입을 언급하지 않도록 수정 [#35763](https://github.com/react/react/pull/35763) +- `react-dom`: 포커스가 위임된 엘리먼트와 이미 포커스된 엘리먼트의 포커스 처리 수정 [#36010](https://github.com/react/react/pull/36010) +- `react-dom`: DOM 명세에 따라 캡처 옵션을 정규화하여 `FragmentInstance` 리스너 누수 수정 [#36047](https://github.com/react/react/pull/36047) +- `react-dom`: 모바일 Safari에서 `<ViewTransition>`이 충돌하는 문제 수정 [#35337](https://github.com/react/react/pull/35337) +- `react-dom`: `SuspenseList`와 함께 사용할 때 `<ViewTransition>`이 충돌하는 문제 수정 [#35520](https://github.com/react/react/pull/35520) +- `react-dom`: `type="number"` 입력의 `defaultValue`를 다른 입력 타입과 일치하도록 업데이트 [#36980](https://github.com/react/react/pull/36980) +- `react-dom`: `innerHTML`이 바뀌지 않았으면 설정하지 않도록 수정 [#36949](https://github.com/react/react/pull/36949) +- `react-dom`: `nonce` 어트리뷰트에서 Hydration 불일치가 잘못 감지되는 문제 수정 [#37030](https://github.com/react/react/pull/37030) +- `react-dom`: Deno에서 `react-dom/server`가 멈추는 문제 수정 [#35235](https://github.com/react/react/pull/35235) +- `react-server`: `decodeReplyFromBusboy`에서 `FormData` 항목이 누락되는 문제 수정 [#36468](https://github.com/react/react/pull/36468) +- `react-server`: 깊은 비동기 체인에서 발생하는 스택 오버플로 [#35612](https://github.com/react/react/pull/35612)와 디버그 정보가 기하급수적으로 늘어나 발생하는 `RangeError` [#37481](https://github.com/react/react/pull/37481) 수정 + +전체 변경 사항은 [변경 로그](https://github.com/react/react/blob/main/CHANGELOG.md)를 참고하세요. --- -_Thanks to [Sam Selikoff](https://x.com/samselikoff) for writing this post, and to [Matt Carroll](https://mattcarrollcode.com/), [Dan Abramov](https://bsky.app/profile/danabra.mov), and [Andrew Clark](https://x.com/acdlite) for reviewing this post._ +_이 글을 작성해주신 [Sam Selikoff](https://x.com/samselikoff), 그리고 이 글을 검토해주신 [Matt Carroll](https://mattcarrollcode.com/), [Dan Abramov](https://bsky.app/profile/danabra.mov), [Andrew Clark](https://x.com/acdlite)에게 감사드립니다._