viclafouch / mui-file-input

A file input designed for the React library MUI
https://viclafouch.github.io/mui-file-input/
MIT License
77 stars 17 forks source link

React Hook Form "Function components cannot be given refs" #22

Closed bryce-palmer closed 1 year ago

bryce-palmer commented 1 year ago

Describe the bug When using MUI File Input with React Hook Form, this stack trace is in the console:

Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()? at V (https://llrkce.csb.app/node_modules/mui-file-input/dist/mui-file-input.umd.js:23:603) at exports.Controller (https://llrkce.csb.app/node_modules/react-hook-form/dist/index.cjs.js:1:21871) at form at App (https://llrkce.csb.app/src/index.js:18:34)

To Reproduce Steps to reproduce the behavior: Load codesandbox of react hook form example. https://codesandbox.io/s/react-hook-form-with-mui-file-input-llrkce?fontsize=14&hidenavigation=1&theme=dark

Desktop (please complete the following information): Windows, Chrome