1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-30 10:39:46 +02:00
planka/client/src/hooks/use-did-update.js
2019-08-31 04:07:25 +05:00

13 lines
317 B
JavaScript

import { useEffect, useRef } from 'react';
export default (callback, dependencies) => {
const isMounted = useRef(false);
useEffect(() => {
if (isMounted.current) {
callback();
} else {
isMounted.current = true;
}
}, dependencies); // eslint-disable-line react-hooks/exhaustive-deps
};