😎 🖥️ React hook to monitor an element enters or leaves the viewport (or another element).
InView
type (#792)- import useInView from "react-cool-inview";
+ import { useInView } from "react-cool-inview";
InView
component, see the example to learn more (thanks to @max-sym)root
(#672).Refactor(types): enhance the types of event properties (#561)
- const { observe } = useInView<HTMLDivElement | null>();
+ const { observe } = useInView<HTMLDivElement>();
scrollDirection
will sync with the scrolling direction of the viewport, see doc (#499)scrollDirection
with the direction of the viewport (#499)observe
API (#500)