New strapi user and having issues with getting images to display

const imageUrl = media.data[0].attributes.url; // Get URL of the first media object
const imageAlt = media.data[0].attributes.alternativeText;

You need to prepend your strapi url

const imageUrl = `http://localhost:1337/${media.data[0].attributes.url; // Get URL of the first media object}`
const imageAlt = media.data[0].attributes.alternativeText;
1 Like