React-hook-form: Unable to use React Hook Form with Material UI's TextField: "Miss name on ref"

Created on 30 Sep 2019  路  3Comments  路  Source: react-hook-form/react-hook-form

Describe the bug
React Hook Form won't work with Material UI's TextField'. Once the form is submit the data is not captured.

To Reproduce
Steps to reproduce the behavior:

  1. Add TextField from Material UI to your project;
  2. Add name & ref;
  3. Try to submit data.

Live CodeSandbox example here.

Expected behavior
It should work just like a regular JSX

Desktop (please complete the following information):
Windows 7
Google Chrome
Version: 77.0.3865.90

question

Most helpful comment

for material ui is inputRef={register({ required: true })}

All 3 comments

for material ui is inputRef={register({ required: true })}

feel free to re-open if this does not solve your issue :)

Splendid! Thank you very much for your help and quick reply as always. :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bjeld picture bjeld  路  3Comments

marcosfsj picture marcosfsj  路  3Comments

jasondibenedetto picture jasondibenedetto  路  3Comments

thekevinbrown picture thekevinbrown  路  3Comments

andrewjrhill picture andrewjrhill  路  3Comments