mirror of
https://github.com/plankanban/planka.git
synced 2025-08-01 03:25:26 +02:00
14 lines
317 B
JavaScript
14 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
|
||
|
};
|