@morizkay/use-in-view
v0.1.3
Published
⭐ ⭐ Check out a working demo [here](https://elinadenfina.github.io/useInView/) ⭐ ⭐
Downloads
1
Readme
useInView with support for Typescript
⭐ ⭐ Check out a working demo here ⭐ ⭐
Install
$ yarn add @morizkay/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>
);
};