@llKryptonixll
Posted
First of all great work. I saw that you wrote :
<img
src="${
screenWidth > 768
? product.image.desktop
: screenWidth > 375
? product.image.tablet
: product.image.mobile
}"
alt="${product.name}"
class="product-image"
/>
You dont need javascript to do it so leave the ternary and write it like this:
<picture>
<source srcset={desktop} media="(min-width: 1024px)" />
<source srcset={tablet} media="(min-width: 768px)" />
<img src={mobile} alt={name} />
</picture>
`
`
Marked as helpful
@Deeperr0
Posted
@llKryptonixll Thank you so much for the tip I will change it right now!