Skip to content

Commit

Permalink
chore(docs): update docs for error message no-img-element (#69312)
Browse files Browse the repository at this point in the history
The `unoptimized` option was a bit hidden so I added an example code
snippet.

x-ref: https://x.com/KibruKuture/status/1827597148424175678
  • Loading branch information
styfle committed Aug 26, 2024
1 parent 26a8824 commit 50b5c7b
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions errors/no-img-element.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ An `<img>` element was used to display an image instead of `<Image />` from `nex

## Possible Ways to Fix It

Use [`next/image`](/docs/pages/api-reference/components/image) to improve performance with automatic [Image Optimization](/docs/pages/building-your-application/optimizing/images).
1. Use [`next/image`](/docs/pages/api-reference/components/image) to improve performance with automatic [Image Optimization](/docs/pages/building-your-application/optimizing/images).

> Note: If deploying to a [managed hosting provider](/docs/pages/building-your-application/deploying), remember to check provider pricing since optimized images might be charged differently than the original images.
>
Expand Down Expand Up @@ -39,9 +39,17 @@ function Home() {
export default Home
```

If you would like to use `next/image` features such as blur-up placeholders but disable Image Optimization, you can do so using [unoptimized](/docs/pages/api-reference/components/image#unoptimized).
2. If you would like to use `next/image` features such as blur-up placeholders but disable Image Optimization, you can do so using [unoptimized](/docs/pages/api-reference/components/image#unoptimized):

Or, use a `<picture>` element with the nested `<img>` element:
```jsx filename="pages/index.js"
import Image from 'next/image'

const UnoptimizedImage = (props) => {
return <Image {...props} unoptimized />
}
```

3. You can also use the `<picture>` element with the nested `<img>` element:

```jsx filename="pages/index.js"
function Home() {
Expand Down

0 comments on commit 50b5c7b

Please sign in to comment.