good day! using react , react-dropzone , immutability helper
users can drop cvs files in , list appears file names in input boxes can change filenames if needed.
the filelist set
ondrop = (acceptedfiles, rejectedfiles, e) => { this.setstate({ files: acceptedfiles }); }
setstate({files: acceptedfiles })
i have inputs onchange wired onchangehandler function.
i encountered error of read-only name on #<file>
object , came across advice use update immutability helpers.
so came this
onchangehandler = (event) =>{ let id = event.target.id; this.setstate(update(this.state.files[id], {name: {$set: event.target.value }})); }
however upon editing file name in input produces uncaught typeerror: failed construct 'file': 2 arguments required, 0 present.
i means have no idea how modify update() satisfy file recreation.
or there more suitable approach?
thank if can chime in.
Comments
Post a Comment