@owaiswiz/use-in-view

1.0.16 • Public • Published

useInView

Check if your component is in viewport using this simple hook!

Build Status code style: prettier GitHub top language npm bundle size (scoped) David

Check out a working demo here

Install

$ yarn add use-in-view

Usage

import useInView from 'use-in-view';

const AnimatedComponent = () => {
	const offset = 30;
	const [ref, inView] = useInView(offset);

	return (
		<div className={`${inView && 'in-view'}`} ref={ref}>
			Animate me!
		</div>
	);
};

Package Sidebar

Install

npm i @owaiswiz/use-in-view

Weekly Downloads

40

Version

1.0.16

License

MIT

Unpacked Size

4.98 kB

Total Files

4

Last publish

Collaborators

  • owaiswiz