⚛️React useAppear hook.
(Created by create-n.)
yarn add use-appear
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>
);
}