Reputation: 41
I have a problem with Strapi v4, I can not display the image from Strapi.
Here is the data structure in Strapi: json-data
I tried to access the image with this source code but in vain : code-source reactjs
I get this error : Uncaught TypeError: Cannot read properties of undefined (reading 'data')
Please help me, I am new to Strapi
Upvotes: 0
Views: 1212
Reputation: 41
I found the solution.
From the new version of strapi ( Strapi v4), all I had to do was to make the get request populate so I could get access to the image :
useEffect(() => {
axios.get("http://localhost:1337/api/articles?populate=*").then((res) => {
setPosts(res.data);
});
}, []);
Upvotes: 3
Reputation: 535
maybe you are pointing in the wrong url of photos, just try without apiURL, because your images url already deployed in cloudinary
Upvotes: 0