React MaterialUI component – CardMedia does not show the image when we provide a URL to the given
prop – image={imageURL}
<CardMedia
component="img"
sx={{
height: 140
}}
image={imageLink}
alt={imageLink.split("/")[4]}
/>
A few examples for the CardMedia Docs are presented here – CardMedia Code Examples
but none showed a CardMedia using an image source given by a URL.
The previous question asked did not resolve the issue – Material-UI CardMedia image not showing
2
Answers
If you are using
img
ascomponent
then you have to use src={imageLink}but the working way is as below:
React js
Next js
That’s it.
Looks like your issue is with the provided media URL.
Try this and check the error log.