Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

vivaxy/use-appear

Repository files navigation

useAppear

Build Status NPM Version NPM Downloads MIT License Standard Version Codecov

⚛️React useAppear hook.

(Created by create-n.)

Install

yarn add use-appear

Usage

import * as React from 'react';
import useAppear from 'use-appear';

export default function AppearElement() {
  const [ref] = useAppear(function() {
    console.log('appear');
    return function() {
      console.log('disappear');
    };
  });

  return (
    <div ref={ref}>Element</div>
  );
}