@gitgw/use-fade-in

1.0.1 • Public • Published

@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

Argument Type Description Required Default value
duration Number Sets the duration of the transition. In seconds no 1
delay Number Delays of transition's start. In seconds no 0

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

Package Sidebar

Install

npm i @gitgw/use-fade-in

Weekly Downloads

3

Version

1.0.1

License

MIT

Unpacked Size

2.07 kB

Total Files

4

Last publish

Collaborators

  • githubgw