当我在 handleInputChange 上使用 setValues() 函数时,出现此错误:
代码:
import React, { useState, useEffect } from "react";
const useForm = (initialFieldValues) => {
const { values, setValues } = useState(initialFieldValues);
const handleInputChange = (e) => {
const { name, value } = e.target;
const fieldValue = { [name]: value };
this.setValues({
...values,
...fieldValue,
});
};
return {
values,
setValues,
handleInputChange,
};
};
export default useForm;
我该如何解决这个错误?任何回应将不胜感激
潇潇雨雨
幕布斯6054654
相关分类