New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

use-scroll-display

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

use-scroll-display

Slim React Hook for showing elements on scroll as they enter the viewport

latest
Source
npmnpm
Version
1.0.3
Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

use-scroll-display

Slim React Hook for showing elements on scroll as they enter the viewport

Install

npm i use-scroll-display

or

yarn add use-scroll-display

Usage

Basic usage

import React from 'react';
import useScrollDisplay from 'use-scroll-display';

const App = () => {
   const [displayRef, hasDisplayed] = useScrollDisplay();

   // true if element has been displayed, false otherwise
   console.log(hasDisplayed);

   return (
      <div ref={displayRef}>
         Appears when entering the viewport
      </div>
   );
}

Custom offset

You can set the offset by passing a parameter.
It defaults to 200

const [displayRef] = useScrollDisplay(350);

Styles and animations

Currently, only one animation is supported.
More will be added later.

Keywords

react

FAQs

Package last updated on 29 Feb 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts