Skip to content

Updating to v6 breaks Material-UI's Autocomplete, component doesn't update field value, state always return integer 0 #2051

Answered by bluebill1049
markcorrea asked this question in Q&A
Discussion options

You must be logged in to vote

hey @markcorrea there is breaking change with Controller. https://github.com/react-hook-form/react-hook-form/blob/master/CHANGELOG.md

we have removed the following props:

  • onChange
  • onChangeName
  • onBlur
  • onBlurName
  • valueName

and in favor of render prop

-<Controller
-  as={CustomInput}
-  valueName="textValue"
-  onChangeName="onTextChange"
-  control={control}
-  name="test"
-/>
+<Controller
+  render={({ onChange, onBlur, value }) => (
+     <CustomInput onTextChange={onChange} onBlur={onBlur} textValue={value} />
+  )}
+  control={control}
+  name="test"
+/>

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by bluebill1049
Comment options

You must be logged in to vote
1 reply
@bluebill1049
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants