import _slicedToArray from "@babel/runtime-corejs3/helpers/slicedToArray";
import React from 'react';
import ResizeObserver from 'resize-observer-polyfill';

var useResizeObserver = function useResizeObserver(callbck, _ref) {
  var _ref2 = _slicedToArray(_ref, 1),
      element = _ref2[0];

  React.useEffect(function () {
    var resizeObserver = new ResizeObserver(function () {
      callbck();
    });
    resizeObserver.observe(element);
    return function () {
      resizeObserver.disconnect();
    };
  }, []);
};

export default useResizeObserver;