repo.or.cz
/
ProtonMail-WebClient.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Cleanup - unused files / unused exports / duplicate exports
[ProtonMail-WebClient.git]
/
packages
/
hooks
/
useEffectOnce.ts
blob
0a5417867dad2f8c4af32ccd44afef0949a34924
1
import { useEffect, useRef } from 'react';
2
3
const useEffectOnce = (cb: () => void, deps: any[] = []) => {
4
const ref = useRef(false);
5
useEffect(() => {
6
if (ref.current) {
7
return;
8
}
9
ref.current = true;
10
return cb();
11
}, deps);
12
};
13
export default useEffectOnce;