Implement a useEffectOnce hook that runs an effect only once.
exportdefaultfunction Component() {
useEffectOnce(() => {
console.log('Running effect once on mount');
return () => {
console.log('Running clean-up of effect on unmount');
};
});
returnnull;
}
effect: The function that will be executed once. This function has the same parameters and behavior as the first argument of useEffectNothing, just like useEffect.