Deliver perfectly optimized, lazy-loaded images in your React applications with a single component.
npm install @imgnodus/imgnodus-react
import { ImgNodusProvider, useImgNodus, ImgNodusImage } from '@imgnodus/imgnodus-react';
// 1. Wrap your app
function App() {
return (
<ImgNodusProvider config={{ apiKey: 'YOUR_API_KEY' }}>
<ProfileUploader />
</ImgNodusProvider>
);
}
// 2. Upload and Display
function ProfileUploader() {
const { upload, isUploading } = useImgNodus();
const handleUpload = async (file) => {
const { url } = await upload(file);
alert('Optimized URL: ' + url);
};
return (
<ImgNodusImage src="https://api.imgnodus.com/u/abc1.webp" alt="Profile" />
);
}
We're working on automatic layout shift prevention and global state for image loading.