【发布时间】:2021-01-04 00:31:41
【问题描述】:
const [Collect, setCollect] = React.useState({
visible: false,
files:[],
uploading: 0,
team:"",
manager:"",
owner:"",
fileNames: [],
status:""
});
function fileOnChange(e){
// here update files and filenames arrays
}
我有一个功能组件,它有一个带有数组的对象,如上所示。每次从输入中选择新文件时,如何更新数组。 fileOnChange 方法更新添加文件和文件名
【问题讨论】:
-
嗨,你试过什么?您基本上是在要求某人为您编写整个函数。
标签: reactjs react-hooks react-functional-component react-state-management