import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
import { useState } from 'react';
/**
 * useTogglable(): hook used to open/close boolean state.
 */

export var useTogglable = function useTogglable() {
  var _useState = useState(false),
      _useState2 = _slicedToArray(_useState, 2),
      isOpen = _useState2[0],
      setState = _useState2[1];

  var open = function open() {
    return setState(true);
  };

  var close = function close() {
    return setState(false);
  };

  return {
    isOpen: isOpen,
    open: open,
    close: close
  };
};