UNPKG

@atlaskit/pragmatic-drag-and-drop-react-beautiful-dnd-migration

Version:

An optional Pragmatic drag and drop package that enables rapid migration from react-beautiful-dnd to Pragmatic drag and drop

15 lines (14 loc) 344 B
import { useCallback, useEffect, useRef } from 'react'; /** * Allows access to a changing value in a stable way. */ export function useStable(value) { var ref = useRef(value); useEffect(function () { ref.current = value; }, [value]); var getValue = useCallback(function () { return ref.current; }, []); return getValue; }