parent
bea26271a3
commit
a1602d5ea8
1 changed files with 15 additions and 0 deletions
@ -0,0 +1,15 @@ |
||||
import { useRef } from 'react'; |
||||
|
||||
const useIsFirstRender = (): boolean => { |
||||
const isFirstRenderRef = useRef<boolean>(true); |
||||
|
||||
if (isFirstRenderRef.current) { |
||||
isFirstRenderRef.current = false; |
||||
|
||||
return true; |
||||
} |
||||
|
||||
return isFirstRenderRef.current; |
||||
}; |
||||
|
||||
export default useIsFirstRender; |
Loading…
Reference in new issue