react-hook-form-mui
react-hook-form-mui copied to clipboard
onChange doesn't fire for TextFieldElement
trafficstars
Hi,
I am not able to figure it out how to fire the onChange event for TextFieldElement component.
Here is the Example I have tried.
Could you please let me know if anything special required.
Thanks for the plugin.
The TextFieldElement is using onChange for the internal react-hook-form as you can see here: https://github.com/dohomi/react-hook-form-mui/blob/master/src/TextFieldElement.tsx#L41
If you want to watch changes on the TextFieldElement then just use react-hook-form for this:
const value = useWatch('nameOfTextfield');