spfx webpart add file to sharepoint list
onDrop = (acceptedFiles) => {
//console.log(acceptedFiles);
//just one file
let file=acceptedFiles[0];
sp.web.lists.getByTitle("TestList").items.add({
Title: "Upload Attachement"
}).then(r => {
// this will add an attachment to the item we just created to push t sharepoint list
r.item.attachmentFiles.add(file.name, file).then(result => {
console.log(result);
})
})
}