79423454

Date: 2025-02-08 15:44:34
Score: 0.5
Natty:
Report link

It looks like the API is returning the correct image URLs, but your React app isn’t processing them properly. Here are a few things to check:

Test the API Response – Open the image URLs in a browser or check them in Postman to make sure they load correctly.

Fix Data Mapping – In Strapi v4, images are usually inside attributes. Try updating your code:

const images = property.attributes?.images?.data?.map(img => ${apiUrl}${img.attributes.url}) || [];

Check CORS Issues – If images won’t load, check the browser console for CORS errors. Update Strapi’s middlewares.js to allow requests from your frontend. Clear Cache – If the issue persists, clear your Vite cache:

rm -rf .vite && rm -rf node_modules/.vite
npm run dev

Try these steps and let me know if you’re still stuck! 🚀

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Low reputation (1):
Posted by: PokePoke