UNPKG

react-selectable-box

Version:

A React component used hooks that allows you to select elements in the drag area using the mouse

18 lines 440 B
import { useEffect, useRef } from 'react'; function useFirstMountState() { var isFirst = useRef(true); if (isFirst.current) { isFirst.current = false; return true; } return isFirst.current; } var useUpdateEffect = function useUpdateEffect(effect, deps) { var isFirstMount = useFirstMountState(); useEffect(function () { if (!isFirstMount) { return effect(); } }, deps); }; export default useUpdateEffect;