1.0.4 • Published 5 years ago

react-use-is-scrolled-into-view v1.0.4

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

react-use-is-scrolled-into-view

React hook which Check virturel dom enters the user's view.

NPM JavaScript Style Guide

Table of Contents

Install

# Yarn
yarn add react-use-is-scrolled-into-view

# NPM
npm install --save react-use-is-scrolled-into-view

Quick Start

//
// Individual components
//
import {useRef} from 'react';
import useIsScrolledIntoView from 'react-use-is-scrolled-into-view';
const Example = () => {
    const ref = useRef(null);
    const isIntoView = useIsScrolledIntoView(ref);
    return (
        <div ref={ref}  data-inview={isIntoView}>
         
        </div>
    );
};

Usage

NOTE: React hooks require react and react-dom version 16.8.0 or higher.

Related projects

Thanks

This repo was setup with the help of the excellent create-react-library and redux-react-hook.

Contributing

Zach Yu zachyu.tw@gmail.com

License

MIT

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago