MCPcopy Create free account
hub / github.com/QuarkGluonPlasma/react-course-code / updateFileList

Function updateFileList

upload-component/src/Upload/index.tsx:48–58  ·  view source on GitHub ↗
(updateFile: UploadFile, updateObj: Partial<UploadFile>)

Source from the content-addressed store, hash-verified

46 const [ fileList, setFileList ] = useState<Array<UploadFile>>([]);
47
48 const updateFileList = (updateFile: UploadFile, updateObj: Partial<UploadFile>) => {
49 setFileList(prevList => {
50 return prevList.map(file => {
51 if (file.uid === updateFile.uid) {
52 return { ...file, ...updateObj }
53 } else {
54 return file
55 }
56 })
57 })
58 }
59
60 const handleRemove = (file: UploadFile) => {
61 setFileList((prevList) => {

Callers 1

postFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected