1.0.0 • Published 1 year ago

react-use-img v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Use Img

npm version GitHub license GitHub stars

Description

A hook for lazy loading images

Installation

npm install react-use-img

Usage

import { useImg } from 'react-use-img';

function App() {
	const { isLoading, isError, img } = useImg('https://via.placeholder.com/56x56', 56);

	if (isLoading) return <span>Loading...</span>;

	if (isError) return <span>Error</span>;

	return <img {...img} alt="..." />
}

License

MIT

1.0.0

1 year ago