@kodai3/use-effect-once
v0.0.3
Published
React lifecycle hook that runs an effect only once.
Downloads
3
Readme
useEffectOnce
React lifecycle hook that runs an effect only once.
Usage
import { useEffectOnce } from "@kodai3/use-effect-once";
const Demo = () => {
useEffectOnce(() => {
console.log("Running effect once on mount");
return () => {
console.log("Running clean-up of effect on unmount");
};
});
return null;
};
Reference
useEffectOnce((effect: EffectCallback));