Missing "sizes" prop when using Next.js Image component #109
-
I am following the example on the official site to use Next.js Image component. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Thank you for catching this issue. The fix is now available in v2.0.4, and I've updated the example on the documentation website. To have the library produce the |
Beta Was this translation helpful? Give feedback.
-
Thank you for the fix. Would you mind shedding some light on how the `Image` component works as a renderer?
What I find confusing is that I am providing `height` and `width` for each image in the `photos` prop to `PhotoAlbum`. If these are passed to `NextJsImage`, the `sizes` and `fill` are no longer needed and can be omitted.
- Why in the example the `height` and `width` not used in favour of `sizes` and `fill`? Would the `PhotoAlbum` just calculate the container size for each instance of `NextJsImage` in this case?
- Also, the format of values that can be passed to `NextJsImage` is different from the Next.js [documentation](https://nextjs.org/docs/api-reference/next/image#sizes). Is there some calculation involved on sizes in `PhotoAlbum`?
Apologies if my understanding is flawed. I am not an expert in the 'Image' component.
|
Beta Was this translation helpful? Give feedback.
Thank you for catching this issue. The fix is now available in v2.0.4, and I've updated the example on the documentation website. To have the library produce the
sizes
attribute in this case, be sure to supply thesizes
prop in thePhotoAlbum
markup.