react-hooks-helper
react-hooks-helper copied to clipboard
Support for "file" type
reacts-hooks-helper is a nice compact library that helps with forms and steps management.
When using the useForm() with input of type="file" , I found that the default binding does not preserve the values. Any insights on how to use the helper with file inputs.
For example
const GetFileData = (props) => {
const { formData, setForm } = useForm( initialData);
// ... some code skipped
return (
<form>
<input type="file" id="inputfile" name="inputfile" onChange={setForm} />
</form>
);
};
For example when I upload a file, say "TestFile.txt"
the resulting formData does not have the file, but instead only has the file name as: formData = { inputfile: "c:\fakepath\TestFile.txt" }
is there a workaround?
I have a similar issue