1

我正在尝试在使用 React Hook Form 构建的表单中使用React Dropzone,但我无法在表单提交时捕获文件。我已经尝试过Controller,但不能正常工作(没有 dropzone 可以正常工作)。

<S.Dropzone isDragAccept={isDragAccept} {...getRootProps()}>
  <p>Drag 'n' drop file here, or click to select file</p>
  <input type="file" name="file" ref={register} {...getInputProps()} />
</S.Dropzone>

CodeSandbox中的完整代码

如果有人可以帮助我查看问题所在,我将不胜感激。

4

0 回答 0