Usage#
import { useUnmountEffect } from '@primereact/hooks/use-unmount-effect';useUnmountEffect(() => {
socket.close();
});Equivalent to useEffect(() => cleanup, []), expressed as the cleanup by itself. Reads clearer when the mount path has nothing to do.
Signature#
function useUnmountEffect(effect: React.EffectCallback): void;