Description:
useMountEffect is a React hook triggered only once on mount.
How to use it:
1. Install and import the useMountEffect hook.
# NPM $ npm install use-mount-effect
import { useMountEffect } from "use-mount-effect";2. Usages.
const MyComponent = () => {
useMountEffect(() => {
// Do something
});
return <div>Blah blah blah</div>;
};// With cleanup
import { useMountEffect } from "use-mount-effect";
const MyComponent = () => {
useMountEffect(() => {
// Do something
return () => {
// Do something
};
});
return <div>...</div>;
};




