The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/apps/meteor/client/hooks/useComponentDidUpdate.ts

13 lines
363 B

import { useEffect, useRef } from 'react';
export const useComponentDidUpdate = (effect: () => void, dependencies: unknown[] = []): void => {
const hasMounted = useRef(false);
useEffect(() => {
if (!hasMounted.current) {
hasMounted.current = true;
return;
}
effect();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, dependencies);
};