1.0.2 • Published 3 years ago

@practical-react-hooks/use-fade-out v1.0.2

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

@practical-react-hooks/use-fade-out

React Hook to fade out any element.

Installation

yarn

yarn add @practical-react-hooks/use-fade-out

npm

npm i @practical-react-hooks/use-fade-out

Usage

import React from "react";
import useFadeOut from "@practical-react-hooks/use-fade-out";

const App = () => {
  const fadeOut = useFadeOut(5, 10);
  return (
    <div className="App">
      <h1 {...fadeOut}>Hello World</h1>
    </div>
  );
};

Arguments

ArgumentTypeDescriptionRequiredDefault value
durationnumberSets the duration of the transition. In secondsno1
delaynumberDelays of transition's start. In secondsno0

Return

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