16 lines
293 B
TypeScript
16 lines
293 B
TypeScript
|
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;
|