Easy
You're building a simple e-commerce product card in React. The card shows a loading state while the product image loads, and handles errors if the image fails to load. What's missing in this implementation?
1function ProductCard({ product }) {2 const [imageStatus, setImageStatus] = useState('loading');34 // missing code here5 _______________67 return (8 <div className="card">9 <div className="image-container">10 {imageStatus === 'loading' && <LoadingSpinner />}11 {imageStatus === 'error' && <ErrorIcon />}12 <img13 src={product.imageUrl}14 alt={product.name}15 className={imageStatus === 'success' ? 'visible' : 'hidden'}16 />17 </div>18 <h3>{product.name}</h3>19 <p>${product.price}</p>20 </div>21 );22}