import { useEffect } from 'react';

/**
 * 图片预加载
 * @param src
 * @param alt
 * @param style
 * @constructor
 */
const PreloadImage = ({ src, alt, style }: any) => {
  useEffect(() => {
    const img = new Image();
    img.src = src;
  }, [src]);

  return <img src={src} alt={alt} style={style} />;
};

export default PreloadImage;
