react-use-optimized-image
Version:
A React hook for image optimization (format detection, lazy loading, caching, CDN support)
13 lines • 533 B
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { useOptimizedImage } from "./useOptimizedImage";
const App = () => {
const { optimizedSrc, isLoading, imgRef } = useOptimizedImage({
src: "https://example.com/image.jpg",
quality: 80,
cdn: "cloudinary",
lazy: true,
});
return (_jsx("div", { children: isLoading ? (_jsx("p", { children: "Loading..." })) : (_jsx("img", { ref: imgRef, src: optimizedSrc, alt: "Optimized" })) }));
};
export default App;
//# sourceMappingURL=App.js.map