import React, { useEffect, useRef } from 'react';
import Spin from '../spin';
import { jsx as _jsx } from "react/jsx-runtime";
const Fallback = ({
  spin,
  containerStyle,
  containerClassName,
  onLoadStart,
  onLoadEnd
}) => {
  const ref = useRef({
    onLoadStart,
    onLoadEnd
  });
  useEffect(() => {
    if (typeof ref.current.onLoadStart === 'function') {
      ref.current.onLoadStart();
    }
    return () => {
      if (typeof ref.current.onLoadEnd === 'function') {
        ref.current.onLoadEnd();
      }
    };
  }, []);
  return /*#__PURE__*/_jsx("div", {
    style: containerStyle,
    className: containerClassName,
    children: /*#__PURE__*/_jsx(Spin, {
      ...spin
    })
  });
};
export default Fallback;