Files
StevenandGitHub 676be08d32 Warn when legacy prop detected on next/image (#42102)
Instead of hard error, we can try to convert legacy props to the new
props and print a warning.

We still recommend upgrading by running one (or both) codemods because
the new component no longer has a wrapping `<span>`.

<img width="616" alt="image"
src="https://user-images.githubusercontent.com/229881/198756393-7d981686-f4db-485b-9f5f-1ff614d35959.png">

Read more: https://nextjs.org/docs/messages/next-image-upgrade-to-13
2022-10-29 22:22:08 -07:00

23 lines
499 B
JavaScript

import Image from 'next/image'
export default function Page() {
return (
<div className="page">
<h1>Using legacy prop layout="responsive"</h1>
<p>
Even though we don't support "layout" in next/image, we can try to
correct the style and print a warning.
</p>
<Image
id="img"
layout="responsive"
src="/test.png"
width="100"
height="100"
alt="my responsive image"
priority
/>
</div>
)
}