1.0.1 • Published 3 years ago

@gitgw/use-fade-in v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

@gitgw/use-fade-in

React Hook to fade in any element.

Installation

npm

npm i @gitgw/use-fade-in

yarn

yarn add @gitgw/use-fade-in

Usage

import React from "react";
import useFadeIn from "@gitgw/use-fade-in";

function App() {
  const fadeIn = useFadeIn(3, 5);
  
  return (
    <div className="App">
      <h1 {...fadeIn}>This will fade in.</h1>
    </div>
  );
}

Arguments

ArgumentTypeDescriptionRequiredDefault value
durationNumberSets the duration of the transition. In secondsno1
delayNumberDelays of transition's start. In secondsno0

Return

useScroll returns an object containing the following: Return value|Type|Description|Default value| |-|-|-|-| |ref|React ref|A ref created to fadeIn the element|element |style|Object|Style object containing to give to the element as a default|opacity: 0