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
Copy file name to clipboardExpand all lines: src/content/learn/index.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -456,7 +456,7 @@ function MyButton() {
456
456
457
457
```
458
458
459
-
Then, *pass the state down* from `MyApp` to each `MyButton`, together with the shared click handler. You can pass information to `MyButton` using the JSX curly braces, just like you previously did with built-in tags like `<img>`:
459
+
Then, *pass the state down* from `MyApp` to each `MyButton`, together with the shared click handler. You can pass information to `MyButton` using the JSX curly braces, just like you previously did with built-in tags like `<Image />`:
Copy file name to clipboardExpand all lines: src/content/learn/javascript-in-jsx-with-curly-braces.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -381,7 +381,7 @@ body > div > div { padding: 20px; }
381
381
382
382
<Solution>
383
383
384
-
Move the image URL into a property called `person.imageUrl` and read it from the `<img>` tag using the curlies:
384
+
Move the image URL into a property called `person.imageUrl` and read it from the `<Image />` tag using the curlies:
385
385
386
386
<Sandpack>
387
387
@@ -428,7 +428,7 @@ body > div > div { padding: 20px; }
428
428
429
429
In the object below, the full image URL is split into four parts: base URL, `imageId`, `imageSize`, and file extension.
430
430
431
-
We want the image URL to combine these attributes together: base URL (always `'https://react.dev/images/docs/scientists/'`), `imageId` (`'7vQD0fP'`), `imageSize` (`'s'`), and file extension (always `'.jpg'`). However, something is wrong with how the `<img>` tag specifies its `src`.
431
+
We want the image URL to combine these attributes together: base URL (always `'https://react.dev/images/docs/scientists/'`), `imageId` (`'7vQD0fP'`), `imageSize` (`'s'`), and file extension (always `'.jpg'`). However, something is wrong with how the `<Image />` tag specifies its `src`.
Copy file name to clipboardExpand all lines: src/content/learn/passing-props-to-a-component.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
@@ -20,7 +20,7 @@ React components use *props* to communicate with each other. Every parent compon
20
20
21
21
## Familiar props {/*familiar-props*/}
22
22
23
-
Props are the information that you pass to a JSX tag. For example, `className`, `src`, `alt`, `width`, and `height` are some of the props you can pass to an `<img>`:
23
+
Props are the information that you pass to a JSX tag. For example, `className`, `src`, `alt`, `width`, and `height` are some of the props you can pass to an `<Image />`:
24
24
25
25
<Sandpack>
26
26
@@ -51,7 +51,7 @@ body { min-height: 120px; }
51
51
52
52
</Sandpack>
53
53
54
-
The props you can pass to an `<img>` tag are predefined (ReactDOM conforms to [the HTML standard](https://www.w3.org/TR/html52/semantics-embedded-content.html#the-img-element)). But you can pass any props to *your own* components, such as `<Avatar>`, to customize them. Here's how!
54
+
The props you can pass to an `<Image />` tag are predefined (ReactDOM conforms to [the HTML standard](https://www.w3.org/TR/html52/semantics-embedded-content.html#the-img-element)). But you can pass any props to *your own* components, such as `<Avatar>`, to customize them. Here's how!
55
55
56
56
## Passing props to a component {/*passing-props-to-a-component*/}
57
57
@@ -733,7 +733,7 @@ Although the syntax looks slightly different because you're describing propertie
733
733
734
734
#### Adjust the image size based on a prop {/*adjust-the-image-size-based-on-a-prop*/}
735
735
736
-
In this example, `Avatar` receives a numeric `size` prop which determines the `<img>` width and height. The `size` prop is set to `40` in this example. However, if you open the image in a new tab, you'll notice that the image itself is larger (`160` pixels). The real image size is determined by which thumbnail size you're requesting.
736
+
In this example, `Avatar` receives a numeric `size` prop which determines the `<Image />` width and height. The `size` prop is set to `40` in this example. However, if you open the image in a new tab, you'll notice that the image itself is larger (`160` pixels). The real image size is determined by which thumbnail size you're requesting.
737
737
738
738
Change the `Avatar` component to request the closest image size based on the `size` prop. Specifically, if the `size` is less than `90`, pass `'s'` ("small") rather than `'b'` ("big") to the `getImageUrl` function. Verify that your changes work by rendering avatars with different values of the `size` prop and opening images in a new tab.
Copy file name to clipboardExpand all lines: src/content/learn/preserving-and-resetting-state.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1844,7 +1844,7 @@ button {
1844
1844
1845
1845
#### Clear an image while it's loading {/*clear-an-image-while-its-loading*/}
1846
1846
1847
-
When you press "Next", the browser starts loading the next image. However, because it's displayed in the same `<img>` tag, by default you would still see the previous image until the next one loads. This may be undesirable if it's important for the text to always match the image. Change it so that the moment you press "Next", the previous image immediately clears.
1847
+
When you press "Next", the browser starts loading the next image. However, because it's displayed in the same `<Image />` tag, by default you would still see the previous image until the next one loads. This may be undesirable if it's important for the text to always match the image. Change it so that the moment you press "Next", the previous image immediately clears.
You can provide a `key` to the `<img>`tag. When that `key` changes, React will re-create the `<img>`DOM node from scratch. This causes a brief flash when each image loads, so it's not something you'd want to dofor every image in your app. But it makes sense if you want to ensure the image always matches the text.
1921
+
You can provide a `key` to the `<Image />`tag. When that `key` changes, React will re-create the `<Image />`DOM node from scratch. This causes a brief flash when each image loads, so it's not something you'd want to dofor every image in your app. But it makes sense if you want to ensure the image always matches the text.
Copy file name to clipboardExpand all lines: src/content/learn/reacting-to-input-with-state.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -505,7 +505,7 @@ Although this code is longer than the original imperative example, it is much le
505
505
506
506
#### Add and remove a CSS class {/*add-and-remove-a-css-class*/}
507
507
508
-
Make it so that clicking on the picture *removes* the `background--active` CSS class from the outer `<div>`, but *adds* the `picture--active` class to the `<img>`. Clicking the background again should restore the original CSS classes.
508
+
Make it so that clicking on the picture *removes* the `background--active` CSS class from the outer `<div>`, but *adds* the `picture--active` class to the `<Image />`. Clicking the background again should restore the original CSS classes.
509
509
510
510
Visually, you should expect that clicking on the picture removes the purple background and highlights the picture border. Clicking outside the picture highlights the background, but removes the picture border highlight.
Keep in mind that if two different JSX chunks describe the same tree, their nesting (first `<div>` → first `<img>`) has to line up. Otherwise, toggling `isActive` would recreate the whole tree below and [reset its state.](/learn/preserving-and-resetting-state) This is why, if a similar JSX tree gets returned in both cases, it is better to write them as a single piece of JSX.
701
+
Keep in mind that if two different JSX chunks describe the same tree, their nesting (first `<div>` → first `<Image />`) has to line up. Otherwise, toggling `isActive` would recreate the whole tree below and [reset its state.](/learn/preserving-and-resetting-state) This is why, if a similar JSX tree gets returned in both cases, it is better to write them as a single piece of JSX.
***During the initial render,** React will [create the DOM nodes](https://developer.mozilla.org/docs/Web/API/Document/createElement) for `<section>`, `<h1>`, and three `<img>` tags.
127
+
***During the initial render,** React will [create the DOM nodes](https://developer.mozilla.org/docs/Web/API/Document/createElement) for `<section>`, `<h1>`, and three `<Image />` tags.
128
128
***During a re-render,** React will calculate which of their properties, if any, have changed since the previous render. It won't do anything with that information until the next step, the commit phase.
Copy file name to clipboardExpand all lines: src/content/learn/writing-markup-with-jsx.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -181,7 +181,7 @@ JSX looks like HTML, but under the hood it is transformed into plain JavaScript
181
181
182
182
### 2. Close all the tags {/*2-close-all-the-tags*/}
183
183
184
-
JSX requires tags to be explicitly closed: self-closing tags like `<img>` must become `<img />`, and wrapping tags like `<li>oranges` must be written as `<li>oranges</li>`.
184
+
JSX requires tags to be explicitly closed: self-closing tags like `<Image />` must become `<img />`, and wrapping tags like `<li>oranges` must be written as `<li>oranges</li>`.
185
185
186
186
This is how Hedy Lamarr's image and list items look closed:
Copy file name to clipboardExpand all lines: src/content/reference/react-dom/components/common.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -176,7 +176,7 @@ These events fire only for the [`<details>`](https://developer.mozilla.org/en-US
176
176
*[`onToggle`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLDetailsElement/toggle_event): An [`Event` handler](#event-handler) function. Fires when the user toggles the details.
177
177
*`onToggleCapture`: A version of `onToggle` that fires in the [capture phase.](/learn/responding-to-events#capture-phase-events)
178
178
179
-
These events fire for [`<img>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img), [`<iframe>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe), [`<object>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/object), [`<embed>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/embed), [`<link>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link), and [SVG `<image>`](https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/SVG_Image_Tag) elements. Unlike browser events, they bubble in React:
179
+
These events fire for [`<Image />`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img), [`<iframe>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe), [`<object>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/object), [`<embed>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/embed), [`<link>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link), and [SVG `<image>`](https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/SVG_Image_Tag) elements. Unlike browser events, they bubble in React:
180
180
181
181
*`onLoad`: An [`Event` handler](#event-handler) function. Fires when the resource has loaded.
182
182
*`onLoadCapture`: A version of `onLoad` that fires in the [capture phase.](/learn/responding-to-events#capture-phase-events)
0 commit comments