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/client/hooks/useComponentDidUpdate.js

16 lines
338 B

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