R
R
runextjs2021-11-11 18:55:12
Images
runextjs, 2021-11-11 18:55:12

What is the correct setting for the next image component?

Next.js framework. I'm using the next image component:

alt={"some alt"}
src={imageUrl}
height={imageHeight}
width={imageWidth}
/>

My container size (all content in it) has a maximum width of 1150px and images are always in that container.
But next image uses a 1920px wide image (for my screen). https://i.imgur.com/l85veAj.png That's too much! My plan is to setup the config like this:
module.exports = {
images: {
deviceSizes: [640, 750, 828, 1080, 1150],
},
}

That is, set the maximum width to 1150, like my container. It is a bad idea? What would you advise me to do to avoid uploading too large an image?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question