Skip to content
Discussion options

You must be logged in to vote

I was doing it wrong. I was listening for onChange on text field while it should be on AutoComplete

const ControlledAutoComplete = ({
  options = [],
  label,
  renderInput,
  getOptionLabel,
  control,
  defaultValue,
  name,
  errors,
}) => {
  return (
    <Controller
      name={name}
      control={control}
      defaultValue={defaultValue}
      render={({ field }) => (
        <Autocomplete
          options={options}
          getOptionLabel={getOptionLabel}
          renderInput={(params) => (
            <TextField
              {...params}
              label={label}
              error={errors[name]}
              helperText={errors[name] && errors[name].message}
            /…

Replies: 1 comment 1 reply

Comment options

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

Answer selected by Moshyfawn
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