9
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【react-hook-form】TypeError: path split is not a functionのエラー対応

Posted at

react-hook-form

TypeError: path split is not a functionというエラーが出たので

yarn remove react-hook-form
yarn add react-hook-form@^6.11.4

バージョンを下げて対応しようとしたが解決できず、もう1度もとのバージョン("react-hook-form": "^7.9.0",)に戻し、対象となりそうなコードを変更しました。

TaskForm.tsx
// 変更前
  <TextField
    className={styles.text_field}
    id="outlined-basic"
    inputRef={register}
    label="New Task"
    name="taskTitle"
    variant="outlined"
  />
TaskForm.tsx
// 変更後
  <TextField
    className={styles.text_field}
    id="outlined-basic"
    {...register("taskTitle")} //このように変更
    label="New Task"
    variant="outlined"
  />

inputRefnameの値を一つにまとめたところ、エラーは解消しました。

9
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?