If you are working on a big project, create a custom hook. In this way, u can tackle unnecessary renders.
Creating Custom Hook for renderCount.
import { useRef, useEffect } from "react"
export default () => {
const renderCount = useRef(0);
useEffect(() => {
renderCount.current++;
});
return renderCount.current;
};
then…
Top comments (0)