UNPKG

@mantine/hooks

Version:

A collection of 50+ hooks for state and UI management

17 lines (16 loc) 447 B
"use client"; import { useEffect, useRef } from "react"; //#region packages/@mantine/hooks/src/use-did-update/use-did-update.ts function useDidUpdate(fn, dependencies) { const mounted = useRef(false); useEffect(() => () => { mounted.current = false; }, []); useEffect(() => { if (mounted.current) return fn(); mounted.current = true; }, dependencies); } //#endregion export { useDidUpdate }; //# sourceMappingURL=use-did-update.mjs.map