1.0.1 • Published 4 years ago

@lchooks/use-fadein v1.0.1

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

@lchooks/use-fade-in

React Hook to fade in any element.

노마드코더 수업을 들으면서 클론코딩했습니다. Thank you nomadcoders!! https://academy.nomadcoders.co/p/introduction-to-react-hooks

Installation

yarn

yarn add @lchooks/use-fade-in

npm

npm i @lchooks/use-fade-in

Usage

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

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

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:

NameTypeDescription
refReact RefA ref created to fadeIn the element
styleObjectStyle object containing {opacity:0} to give to the element as a default

It's recommended to just spread the returned object on the element as shown in the Usage section above.

1.0.1

4 years ago

1.0.0

4 years ago