huridocs/uwazi

View on GitHub
app/react/V2/CustomHooks/useIsFirstRender.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { useRef } from 'react';

const useIsFirstRender = () => {
  const isFirst = useRef(true);

  if (isFirst.current) {
    isFirst.current = false;

    return true;
  }

  return isFirst.current;
};

export { useIsFirstRender };