mirror of
https://github.com/tiqi-group/pydase.git
synced 2025-06-12 15:57:12 +02:00
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:
11
frontend/src/hooks/useRenderCount.ts
Normal file
11
frontend/src/hooks/useRenderCount.ts
Normal file
@ -0,0 +1,11 @@
|
||||
import { useRef, useEffect } from "react";
|
||||
|
||||
export function useRenderCount() {
|
||||
const count = useRef(0);
|
||||
|
||||
useEffect(() => {
|
||||
count.current += 1;
|
||||
});
|
||||
|
||||
return count.current;
|
||||
}
|
Reference in New Issue
Block a user