You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How is MyInput expected to call the onChange function that is now passed into the component?
I've tried numerous ways to give it a target, a value, both, neither, I feel like I've tried everything.
Looking at the code, it blindly expects a target and a target.name. So just passing onChange(newValue) isn't going to cut the mustard - it wants a event.target.name given event is the first argument. Even though this is hinted in the documented when using a Controller component. But I'm not. I find it too verbose.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I'm making a custom field, namely a checkbox list. Not a totally alien thing to build. Its value is an array of strings.
So when I pass it the destructed register function:
How is
MyInputexpected to call theonChangefunction that is now passed into the component?I've tried numerous ways to give it a target, a value, both, neither, I feel like I've tried everything.
Looking at the code, it blindly expects a
targetand atarget.name. So just passingonChange(newValue)isn't going to cut the mustard - it wants aevent.target.namegiveneventis the first argument. Even though this is hinted in the documented when using aControllercomponent. But I'm not. I find it too verbose.So what do I actually call
onChangewith please?Beta Was this translation helpful? Give feedback.
All reactions