Hapus file input html bereaksi
e.target.value = null;
Blue Beetle
e.target.value = null;
<input onChange={this.onChange} onClick={e => (e.target.value = null)} type="file" />
functionThatResetsTheFileInput() {
let randomString = Math.random().toString(36);
this.setState({
theInputKey: randomString
});
}
render() {
return(
<div>
<input type="file"
key={this.state.theInputKey || '' } />
<button onClick={this.functionThatResetsTheFileInput()} />
</div>
)
}