import React, { useContext } from 'react';
import AccordionContext from './AccordionContext';
import AccordionItem from './AccordionItem.skeleton';
export default function AccordionItemWithContext(props) {
  let {
    index,
    children,
    heading
  } = props;
  let {
    accordionState,
    handleClick,
    position
  } = useContext(AccordionContext);
  return /*#__PURE__*/React.createElement(AccordionItem, {
    index: index,
    isOpen: accordionState[index],
    onClick: handleClick,
    heading: heading,
    position: position
  }, children);
}