An open API service indexing awesome lists of open source software.

https://github.com/mikelpmc/react-intersection-observer

React Intersection Observer hook
https://github.com/mikelpmc/react-intersection-observer

hooks intersection-observer lazy-loading performance react react-hooks web-performance

Last synced: about 1 month ago
JSON representation

React Intersection Observer hook

Awesome Lists containing this project

README

        

## React intersection Observer

React custom hook that uses the Intersection observer API.

[Codesandbox demo](https://codesandbox.io/embed/react-observer-component-14hrj)

#### Getting started

```shell
npm install react-observer-component
```

#### Usage

```jsx
import React from 'react';
import useObserver from 'react-observer-component';

const MyComponent = () => {
const [isInView, ref] = useObserver();

return (


{isInView &&

Only shows when is in viewport!

}

);
};
```

#### [Browser support](https://caniuse.com/#feat=mdn-api_intersectionobserver)

##### Author: Mikel Parra |