【发布时间】:2021-07-02 08:39:57
【问题描述】:
现在我使用react-hook-form 进行登录验证。
但是,TypeError: path.split is not a function 错误继续发生时 ref={register} 在输入标签中输入。
import React from 'react';
import {useForm} from "react-hook-form";
import './Auth.css';
export default function Register() {
const {register, errors, watch} = useForm();
return (
<div>
<form>
<label>Email</label>
<input type="email" name="email" ref={register({ required: true})} />
<label>Password</label>
<input type="password" />
<label>Password Confirm</label>
<input type="password"/>
<input type="submit" />
</form>
</div>
);
}
即使我复制粘贴示例代码,也会出现同样的错误,请问如何解决?
【问题讨论】:
标签: reactjs typeerror react-hook-form