Error says: " Uncaught TypeError: path.split is not a function". I am guessing the error is due to react-hook-form update. Does anyone know this?

Error says: " Uncaught TypeError: path.split is not a function". I am guessing the error is due to react-hook-form update. Does anyone know this?

我想知道如何用新的编码方式解决这个问题。 我听说有人说这个错误是由于 react-hook-form 的更新,但我不确定如何解决这个问题。如果有人知道这一点,我将不胜感激。

错误说:“未捕获的类型错误:path.split 不是一个函数” 我正在使用 "react-hook-form": "^7.3.6",

    <textarea
      name="content"
      ref={register({
        required: { value: true, message: 'content is required' },
        maxLength: { value: 20000, message: 'content is too long' },
        minLength: { value: 10, message: 'content is too short' },
      })}
    ></textarea>

谢谢。

从 v7 开始,register 的用法发生了变化:

<textarea
  {...register('content', {
    required: { value: true, message: 'content is required' },
    maxLength: { value: 20000, message: 'content is too long' },
    minLength: { value: 10, message: 'content is too short' },
  })}
/>

这里是相关的 section 文档以获取更多信息。