1.0.0 • Published 3 years ago

@ej-hooks/use-fade-in v1.0.0

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

@ej-hooks/use-fade-in

React Hook to fade in any element.

Installation

yarn

yarn add @ej-hooks/use-fade-in

npm

npm i @ej-hooks/use-fade-in

Usage

import React from 'react';
import useFadeIn from '@ej-hooks/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

Return valueTypeDescriptionDefault value
refReact RefA ref created to fadeIn the elementnull
styleObjectStyle object{opacity:0}

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