import { useZoomImage } from 'usezoomimage';
function App() {
const [showImage, setShowImage] = React.useState(false);
const [ref, ExpandedImage] = useZoomImage(showImage, { backdrop: true });
return (
<div>
<img
ref={ref}
src={PlaceholderImage}
alt="Placeholder Image"
width={450}
height={300}
onClick={() => setShowImage(true)}
style={{
cursor: 'pointer',
opacity: showImage ? 0 : 1
}}
/>
<ExpandedImage backdropOnClick={() => setShowImage(false)} />
</div>
);
};
-
Notifications
You must be signed in to change notification settings - Fork 0
React hook giving an image a cool zoom animation
License
fletch-r/useZoomImage
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
React hook giving an image a cool zoom animation