Initial commit
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
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
|
||||
};
|
||||
Reference in New Issue
Block a user