import React, { useLayoutEffect } from 'react';

/**
 * Wraps the children of a portal to allow for React rendering
 * lifecycle hook to be exposed, primarily for node virtualization.
 */
export const PortalRenderWrapperInner = ({
  getChildren,
  onBeforeRender
}) => {
  useLayoutEffect(() => {
    if (onBeforeRender) {
      onBeforeRender();
    }
  }, [onBeforeRender]);
  return /*#__PURE__*/React.createElement(React.Fragment, null, getChildren());
};