react-hook-form 错误:transformToNestObject 不是函数

时间:2021-04-28 10:48:44

标签: reactjs yup react-hook-form

我想使用 Material-UI 单选按钮,在 react-hook-form 更新后,验证会引发以下错误:

transformToNestObject is not a function

Controller 包装器不正确吗?

Sandbox example

  <Controller
    render={({ field, fieldState }) => (
      <RadioGroup {...field} aria-label="option">
        <FormControlLabel
          value="A"
          control={<Radio size="small" color="primary" />}
          label="A"
        />
        <FormControlLabel
          value="B"
          control={<Radio size="small" color="primary" />}
          label="B"
        />
      </RadioGroup>
    )}
    name="option"
    control={control}
  />

1 个答案:

答案 0 :(得分:2)

尝试将 @hookform/resolvers 软件包升级到最新版本。 Source