Create a React functional component that converts and image upload to base64.
Here's an example of a React functional component that converts an image upload to base64:

import React, { useState } from react;

const ImageUpload = () => {
  const [image, setImage] = useState();

  const handleImageChange = (event) => {
    const file = event.target.files[0];
    const reader = new FileReader();
    reader.readAsDataURL(file);
    reader.onloadend = () => {
      setImage(reader.result);
    };
  };

  return (
    <div>
      <input type=file onChange={handleImageChange} />
      <br />
      <br />
      {image && <img src={image} alt=Uploaded Image />}
    </div>
  );
};

export default ImageUpload;

This component has a handleImageChange function that is triggered when the file input is changed. It creates a FileReader object and uses the readAsDataURL method to read the selected file as base64 encoded data. The base64 encoded image is then set as the state for the component using the setImage function. The component also displays the image using an img element if the state is not empty.
Does this code need to check if a file-type other than an image file-type is uploaded?