Next.js Discord

Discord Forum

Why NextImage with fill property requires sizes?

Unanswered
Chum salmon posted this in #help-forum
Open in Discord
Chum salmonOP
The idea of fill property is to use the size of the container.
If I don't specify it, I don't get an error from vscode but the browser console is so mad about it.
warn-once.js:16 Image with src "/images/postsMockupImages/sample-ghibli.jpg" has "fill" but is missing "sizes" prop.

Is there a way to handle this?
Currently my code is simple:
    <Image
        src={choice.image}
        alt={choice.name}
        fill
        className="nextImage"
    />

0 Replies