import _toConsumableArray from "@babel/runtime-corejs3/helpers/toConsumableArray";
import _slicedToArray from "@babel/runtime-corejs3/helpers/slicedToArray";
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
import * as React from 'react';
export default function usePatchElement() {
  var _React$useState = React.useState([]),
      _React$useState2 = _slicedToArray(_React$useState, 2),
      elements = _React$useState2[0],
      setElements = _React$useState2[1];

  function patchElement(element) {
    setElements(function (originElements) {
      var _context;

      return _concatInstanceProperty(_context = []).call(_context, _toConsumableArray(originElements), [element]);
    });
    return function () {
      setElements(function (originElements) {
        return _filterInstanceProperty(originElements).call(originElements, function (ele) {
          return ele !== element;
        });
      });
    };
  }

  return [elements, patchElement];
}