import { useState, useEffect } from "react";
import withHelperText from "../../../hoc/withHelperText";
import withLabel from "../../../hoc/withLabel";
import ImageWidget, { ImageProps } from "./ImageWidget";

const ImageContainer = (props: ImageProps) => {
  const [imageProps, setImageProps] = useState<ImageProps>({} as ImageProps);
  
  useEffect(() => {
    setImageProps({ ...props });
  }, [props]);
  
  return <ImageWidget {...imageProps} />;
};
export default withHelperText(withLabel(ImageContainer));
