I am using controller component of react-hook-form
to call material UI autocomplete.
When I'm passing defaultValue
parameter then it is populating in field but when click on submit button then showing validation error message:
shared_with_users must be a `array` type, but the final value was: `null` (cast from the value `{ "value": "571998", "label": "\"Satyendra Kumar\"" }`). If "null" is intended as an empty value be sure to mark the schema as `.nullable()`
Here is my code: https://codesandbox.io/s/nervous-tree-9e2js?file=/src/App.js
Autocomplete is coming after selection of last select box. I am using yup for form validation.
Please suggest the fixes.
Thank you in advance