frontend: introduces useRenderCount hook

The useRenderCount hook contains all the necessary logic to count the re-render events.
This reduces duplication and code complexity.
This commit is contained in:
Mose Müller
2024-07-08 15:06:22 +02:00
parent a5a957d290
commit b1e6663c66
11 changed files with 49 additions and 79 deletions

View File

@ -0,0 +1,11 @@
import { useRef, useEffect } from "react";
export function useRenderCount() {
const count = useRef(0);
useEffect(() => {
count.current += 1;
});
return count.current;
}