This is the situation: I get an image as input, and then I have to display it, and i got no issues with that. Next I need to convert the URL.createObjectURL (event.target.files [0]) to base64, in order to pass it to the backend. Do you have any idea how to do it? I will attach the code below.
const onImageChange = (event) => {
  if (event.target.files && event.target.files[0]) {
    setImage(URL.createObjectURL(event.target.files[0]));
    console.log(event.target.files[0]);
    //var convertedImageBase64 = Convert the image i get from file system to base64
    setImageName(convertedImageBase64);
  }
}
