Skip to content

Problem with Array with multiple nested arrays #7737

Discussion options

You must be logged in to vote

So, there're a couple of issue with what you're trying to do.

  • The main one is that you're using RHF V7 (7.22.5)
"dependencies": {
  "react-hook-form": "7.22.5"
},

but the way you're using the <Controller /> is from V6

render={({ value, onChange }) => (
  <input value={value} onChange={onChange} />
)}

Since V7, the API for <Controller /> has changed and now requires you to access your field value and handlers from the field property returned from render

render={({ field }) => (
  <input value={field.value} onChange={field.onChange} />
)}

Please, refer to the RHF V7 docs to learn more about the current API

  • Second point is RHF doesn't support flat arrays. What that means is you can't have…

Replies: 3 comments 26 replies

Comment options

You must be logged in to vote
2 replies
@julio3266
Comment options

@julio3266
Comment options

Comment options

You must be logged in to vote
24 replies
@Moshyfawn
Comment options

@julio3266
Comment options

@JamesWong1999
Comment options

@Moshyfawn
Comment options

@julio3266
Comment options

Answer selected by Moshyfawn
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
5 participants