react-dropzone-uploader
react-dropzone-uploader copied to clipboard
how I can reset my component Dropzone whit state?
how I can reset my component Dropzone whit state? My state is
this.state = {
files : [],
}
My component is
<Dropzone
getUploadParams={this.getUploadParams}
onChangeStatus={this.handleChangeStatus}
onSubmit={this.handleSubmitUploadFile}
initialFiles={this.state.files || ''}
accept=".XLS,.XLSX"
inputContent={(files, extra) => (extra.reject ? 'Archivos' : 'Arrastrar archivo')}
canRestart={true}
canCancel={true}
canRemove={true}
multiple={false}
maxFiles={1}
maxSizeBytes={(1024 * 1024) * 6}
/>
But I need to reset it from a button, using the event onClick
My botton is
<Button size="sm" color="danger" onClick={this.resetFormImport}><i className="fa fa-ban"></i> Reset</Button>
Reset I try to update my state to refresh the component but it doesn't give any results.
resetFormImport() {
this.setState({
files : [],
})
}
Some solution??
how I can reset the component??
Good catch. I think this could be due to the CSS margin. Will work on a fix in the js function.
Yes I think so, I will fix it in the js function
alright great!
Resolved by #46