import _extends from "@babel/runtime/helpers/extends";
import React, { useContext, useRef } from 'react';
import { observer } from 'mobx-react-lite';
import TableTBody from './TableTBody';
import TableContext from './TableContext';

var ExpandableTableTBody = function ExpandableTableTBody(props) {
  var _useContext = useContext(TableContext),
      isBodyExpanded = _useContext.tableStore.isBodyExpanded;

  var rendered = useRef(false);

  if (isBodyExpanded || rendered.current) {
    rendered.current = true;
    return /*#__PURE__*/React.createElement(TableTBody, _extends({}, props, {
      hidden: !isBodyExpanded
    }));
  }

  return null;
};

ExpandableTableTBody.displayName = 'ExpandableTableTBody';
export default observer(ExpandableTableTBody);
//# sourceMappingURL=ExpandableTableTBody.js.map
