Next.js - Dealing with API Fetched Images

47 views Asked by At

I'm using Next.js' Image component with images fetched from an API. Since I don't have the image dimensions, how should I handle the width prop requirement?

Should I ask the backend team to include width and height in the API response, or are there other solutions?

1

There are 1 answers

0
Muhammad RAZA On

You can add some custom post fetch hooks on the server side to generate various variants of images and then you can utilize the required variant as you want