I'm my app, I have a file input to submit a file and send it to a firebase storage bucket. I'm using the react-hook-form library for this task. The problem is, that I wanted to make the file to be uploaded by only having the input element, I didn't want to have a button to submit it. This is all related to the styles, I could make a submit button and it would certainly work. I saw a video in which the author shows how to create this functionality and even integrate it with firebase, but he has a submit button
This is my how he did it
import React from "react";
import { useForm } from "react-hook-form";
function App() {
const { register, handleSubmit } = useForm()
const onSubmit = (data) => {
console.log(data)
}
return (
<form onSubmit={handleSubmit(onSubmit)}>
<input ref={register} type="file" name="picture" />
<button>Submit</button>
</form>
);
}
export default App;
To see the firebase implementation, you can check this link