UNPKG

simpleton-state-manager

Version:

A Simple State Manager for WebApp UI

23 lines (16 loc) 404 B
import React, { useRef } from 'react'; export const useRenderCounter = () => { const renderCountRef = useRef(0); const increaseFn = () => { renderCountRef.current += 1; }; return [renderCountRef, increaseFn]; }; const RenderCounter = ({ className }) => { const [renderCount, increaseFn] = useRenderCounter(); increaseFn(); return ( <></> ); }; export default RenderCounter;