Skip to content

Commit 8ec8c6c

Browse files
merging all conflicts
2 parents 89f79e9 + 0821e7d commit 8ec8c6c

10 files changed

Lines changed: 616 additions & 128 deletions

File tree

‎src/content/reference/dev-tools/react-devtools-cdt-mcp.md‎

Lines changed: 407 additions & 0 deletions
Large diffs are not rendered by default.

‎src/content/reference/react-compiler/directives.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,12 @@ function ProblematicComponent() {
193193
194194
## 참고 {/*see-also*/}
195195
196+
<<<<<<< HEAD
196197
* [`compilationMode`](/reference/react-compiler/compilationMode) - 컴파일러가 최적화 대상을 선택하는 방식을 설정합니다.
197198
* [`Configuration`](/reference/react-compiler/configuration) - 전체 컴파일러 설정 옵션.
198199
* [React Compiler documentation](/learn/react-compiler) - 시작 가이드.
200+
=======
201+
* [`compilationMode`](/reference/react-compiler/compilationMode) - Configure how the compiler chooses what to optimize
202+
* [`Configuration`](/reference/react-compiler/configuration) - Full compiler configuration options
203+
* [React Compiler documentation](/learn/react-compiler) - Getting started guide
204+
>>>>>>> 0821e7d9428a6c58c922765b891bbffba9ed6249

‎src/content/reference/react-dom/components/img.md‎

Lines changed: 43 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ To display an image, render the [built-in browser `<img>` component](https://dev
5151

5252
* Do not pass an empty string to `src`. It may cause the browser to request the current page again. React warns in development and omits the attribute. To render no image, omit the `<img>` or pass `null` to `src`.
5353
* `<img>` cannot have children or use `dangerouslySetInnerHTML`. React throws an error if you pass either.
54-
* `fetchPriority="low"` does not stop React from waiting for the image to load and decode during a client-rendered View Transition update. Use `loading="lazy"` or an `onLoad` handler to opt out of that behavior.
54+
* `fetchPriority="low"` does not stop React from waiting for the image to load during a client-rendered View Transition update. Use `loading="lazy"` or an `onLoad` handler to opt out of that behavior.
5555

5656
---
5757

@@ -125,25 +125,26 @@ To create an explicit preload hint, call [`preload`](/reference/react-dom/preloa
125125

126126
### Waiting for an image during a View Transition {/*waiting-for-an-image-during-a-view-transition*/}
127127

128-
During a client-rendered [`<ViewTransition>`](/reference/react/ViewTransition) update, React may wait for an image to load and decode before starting the animation. This applies when a new `<img>` with a non-empty `src` is rendered, or when an existing image's `src` or `srcSet` changes. The image must be inside the `<ViewTransition>` subtree and must not have `loading="lazy"` or an `onLoad` handler. React does not wait for images during synchronous updates.
128+
During a [`<ViewTransition>`](/reference/react/ViewTransition) update, React waits up to 500 ms for visible images to load before starting the animation. This includes newly rendered `<img>` elements and existing images whose `src` or `srcSet` changes. Setting `loading="lazy"` or adding an `onLoad` handler opts an image out.
129129

130-
When a Suspense boundary reveals streamed content inside a `<ViewTransition>`, React may also wait for visible images with a non-empty `src` that do not have `loading="lazy"`. React stops waiting after a timeout so that a slow image does not block the update indefinitely.
131-
132-
In this example, the Suspense boundary is wrapped in a `<ViewTransition>` and shows a profile skeleton until the portrait has loaded.
133-
134-
For comparison, the second button inserts the same card directly into the DOM. The card appears immediately, and the browser displays the image after it loads:
130+
Compare how the same image appears when a Suspense boundary reveals its content inside and outside a `<ViewTransition>`:
135131

136132
<Sandpack>
137133

138134
```js
139-
import { ViewTransition, Suspense, useState, startTransition } from 'react';
140-
import { freshImageUrl } from './image.js';
141-
import VanillaProfile from './VanillaProfile.js';
142-
143-
function Profile({ src }) {
135+
import {
136+
ViewTransition,
137+
Suspense,
138+
use,
139+
useState,
140+
} from 'react';
141+
import { fetchImageSrc } from './image.js';
142+
143+
function Profile({ cacheKey }) {
144+
const src = use(fetchImageSrc(cacheKey));
144145
return (
145146
<div className="card">
146-
<img src={src} alt="Jack Pope" width={80} height={80} />
147+
<img src={src} alt="" width={80} height={80} />
147148
<p>Jack Pope</p>
148149
</div>
149150
);
@@ -159,56 +160,51 @@ function ProfilePlaceholder() {
159160
}
160161

161162
export default function App() {
162-
const [src, setSrc] = useState(null);
163+
const [showWithTransition, setShowWithTransition] =
164+
useState(false);
165+
const [showWithoutTransition, setShowWithoutTransition] =
166+
useState(false);
163167
return (
164168
<>
165-
<button
166-
onClick={() => {
167-
startTransition(() => {
168-
setSrc(freshImageUrl());
169-
});
170-
}}>
171-
Show profile
169+
<button onClick={() => setShowWithTransition(true)}>
170+
Show profile with View Transition
172171
</button>
173-
{src && (
172+
{showWithTransition && (
174173
<ViewTransition>
175174
<Suspense fallback={<ProfilePlaceholder />}>
176-
<Profile src={src} />
175+
<Profile cacheKey="with-transition" />
177176
</Suspense>
178177
</ViewTransition>
179178
)}
180179
<hr />
181-
<VanillaProfile />
180+
<button onClick={() => setShowWithoutTransition(true)}>
181+
Show profile without View Transition
182+
</button>
183+
{showWithoutTransition && (
184+
<Suspense fallback={<ProfilePlaceholder />}>
185+
<Profile cacheKey="without-transition" />
186+
</Suspense>
187+
)}
182188
</>
183189
);
184190
}
185191
```
186192

187-
```js src/VanillaProfile.js
188-
import { useRef } from 'react';
189-
import { freshImageUrl } from './image.js';
193+
```js src/image.js hidden
194+
// Normally, the caching logic would be inside a framework.
195+
const cache = new Map();
190196

191-
export default function VanillaProfile() {
192-
const ref = useRef(null);
193-
function show() {
194-
ref.current.innerHTML = `<div class="card">
195-
<img src="${freshImageUrl()}" alt="Jack Pope" width="80" height="80" />
196-
<p>Jack Pope</p>
197-
</div>`;
197+
export function fetchImageSrc(cacheKey) {
198+
if (!cache.has(cacheKey)) {
199+
cache.set(cacheKey, loadImageSrc());
198200
}
199-
return (
200-
<>
201-
<button onClick={show}>Show profile (direct DOM update)</button>
202-
<div ref={ref} />
203-
</>
204-
);
201+
return cache.get(cacheKey);
205202
}
206-
```
207203

208-
```js src/image.js hidden
209-
// Add a unique parameter so the image isn't cached,
210-
// and every run shows the loading state.
211-
export function freshImageUrl() {
204+
async function loadImageSrc() {
205+
// Delay the response so the Suspense fallback is visible.
206+
await new Promise(resolve => setTimeout(resolve, 1000));
207+
// Add a unique parameter so the image isn't cached.
212208
return 'https://react.dev/images/team/jack-pope.jpg?t=' + Date.now();
213209
}
214210
```
@@ -255,3 +251,5 @@ hr {
255251
```
256252

257253
</Sandpack>
254+
255+
With `<ViewTransition>`, React keeps the skeleton visible for up to 500 ms while the image loads, so the card can be revealed with its image already in place. Without `<ViewTransition>`, Suspense stops showing the skeleton as soon as the Promise resolves. If the image is still loading, the card appears first and the image pops in afterward.

‎src/content/reference/react-dom/preinitModule.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,22 @@ function AppRoot() {
4444

4545
#### 매개변수 {/*parameters*/}
4646

47+
<<<<<<< HEAD
4748
* `href`: 문자열입니다. 다운로드하고 실행할 모듈의 URL입니다.
4849
* `options`: 객체입니다. 다음 속성을 포함합니다:
4950
* `as`: 필수 문자열입니다. 반드시 `'script'`여야 합니다.
5051
* `crossOrigin`: 문자열입니다. 사용할 [CORS policy](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin)을 지정합니다. 가능한 값은 `anonymous` 또는 `use-credentials`입니다.
5152
* `integrity`: 문자열입니다. 모듈의 암호학적 해시로, [무결성을 검증](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity)하는 데 사용됩니다.
5253
* `nonce`: 문자열입니다. 엄격한 Content Security Policy를 사용할 때 모듈을 허용하기 위한 암호학적 [nonce](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/nonce)입니다.
54+
=======
55+
* `href`: a string. The URL of the module you want to download and execute.
56+
* `options`: an object. It contains the following properties:
57+
* `as`: a required string. It must be `'script'`.
58+
* `crossOrigin`: a string. The [CORS policy](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin) to use. Its possible values are `anonymous` and `use-credentials`.
59+
* `integrity`: a string. A cryptographic hash of the module, to [verify its authenticity](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity).
60+
* `nonce`: a string. A cryptographic [nonce to allow the module](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/nonce) when using a strict Content Security Policy.
61+
* `fetchPriority`: a string. Suggests a [relative priority](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/fetchpriority) for fetching the resource; possible values are `auto` (default), `high`, and `low`.
62+
>>>>>>> 0821e7d9428a6c58c922765b891bbffba9ed6249
5363
5464
#### 반환값 {/*returns*/}
5565

‎src/content/reference/react-dom/preloadModule.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,23 @@ function AppRoot() {
4444

4545
#### 매개변수 {/*parameters*/}
4646

47+
<<<<<<< HEAD
4748
* `href`: 문자열입니다. 다운로드하려는 모듈의 URL입니다.
4849
* `options`: 객체입니다. 여기에는 다음과 같은 속성들이 포함되어 있습니다.
4950
* `as`: 필수 문자열입니다. `'script'`여야 합니다.
5051
* `crossOrigin`: 문자열입니다. 사용할 [CORS 정책](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin)입니다. 가능한 값은 `anonymous`와 `use-credentials`입니다.
5152
* `integrity`: 문자열입니다. 모듈의 [신뢰성 확인](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity)을 위한
5253
모듈의 암호화 해시입니다.
5354
* `nonce`: 문자열입니다. 엄격한 컨텐츠 보안 정책을 사용할 때 [모듈을 허용하기 위한 암호화 논스(Nonce)](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/nonce)입니다.
55+
=======
56+
* `href`: a string. The URL of the module you want to download.
57+
* `options`: an object. It contains the following properties:
58+
* `as`: a required string. It must be `'script'`.
59+
* `crossOrigin`: a string. The [CORS policy](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin) to use. Its possible values are `anonymous` and `use-credentials`.
60+
* `integrity`: a string. A cryptographic hash of the module, to [verify its authenticity](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity).
61+
* `nonce`: a string. A cryptographic [nonce to allow the module](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/nonce) when using a strict Content Security Policy.
62+
* `fetchPriority`: a string. Suggests a [relative priority](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/fetchpriority) for fetching the resource; possible values are `auto` (default), `high`, and `low`.
63+
>>>>>>> 0821e7d9428a6c58c922765b891bbffba9ed6249
5464
5565

5666
#### 반환값 {/*returns*/}

0 commit comments

Comments
 (0)