a component that renders an image with a fallback if the image fails to load.
Installation
eslint
You can use the following eslint rule to prevent the use of next/image
a component that renders an image with a fallback if the image fails to load.
You can use the following eslint rule to prevent the use of next/image


import Img from "@/components/ui/Img";
<Img
src="/some-url.png"
alt="test"
width={200}
height={200}
className="rounded-sm border"
/>
{
"rules": {
"no-restricted-imports": [
"error",
{
"name": "next/image",
"message": "Please import from `@/components/ui/Img` instead.",
"importNames": ["default"]
}
]
}
}