1.0.2 • Published 5 months ago

react-intersection-observer-inview v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

react-intersection-observer-inview

Getting Started

  npm install react-intersection-observer-inview

Usage

import React from 'react';
import { useIntersectionObserver } from 'react-intersection-observer-inview';

const Component = () => {
  const { ref, inView } = useIntersectionObserver({
    // Optional options
    root: // Not used because ref was used
    threshold: 0,
    rootMargin: '0px 0px 0px 0px',
  });

  return (
    <div ref={ref}>
      <span>{`Inview state ${inView}.`}</span>
    </div>
  );
};

LICENSE

MIT