fix(striker-ui): add useIsFirstRender hook

main
Tsu-ba-me 2 years ago
parent bea26271a3
commit a1602d5ea8
  1. 15
      striker-ui/hooks/useIsFirstRender.ts

@ -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…
Cancel
Save