Image viewer (aka Lightbox) React Hook
npm install react-image-viewer-hookuseImageViewer)Image viewer (aka Lightbox) made for React. Images only (no videos, iframes, custom html, ...), with a focus on touch interactions (swipe between images, pinch to zoom, pan around, swipe down to dismiss). Internal heavy lifting is done by react-spring and use-gesture. Supports code-splitting by default (image viewer code is only loaded once first opened). The image viewer chunk comes at around 37kB gzipped.
Demo: https://codesandbox.io/s/react-image-viewer-hook-demo-6ty7g
Example:
``tsx
import { useImageViewer } from 'react-image-viewer-hook'
function Page() {
const { getOnClick, ImageViewer } = useImageViewer()
return (
<>
![]()
![]()
>
)
}
``