mirror of
https://github.com/streamich/react-use.git
synced 2026-01-25 14:17:16 +00:00
feat(useFirstMountState): hook to track if render is first; feat(useRendersCount): hook to track renders count; refactor(useUpdateEffect): now uses useFirstMountState hook; refactor(usePreviousDistinct): now uses with useFirstMountState hook; docs: update readme;
6 lines
109 B
TypeScript
6 lines
109 B
TypeScript
import { useRef } from 'react';
|
|
|
|
export function useRendersCount(): number {
|
|
return ++useRef(0).current;
|
|
}
|