how to clear data in textbox in reactjs? After submit of the form I want to clear all the data as well as on click of cancel button. Can anyone help please ?
//Create Form
onSubmit(e){
e.preventDefault();
if(this.handleValidation()){
alert("Form submit");
}
}
//Cancel Form
onCancel(e){
e.preventDefault();
alert("Cancel");
// e.target.reset();
}
<button type="submit" className="btn btn-success active" onClick={this.onSubmit}><b>Create</b></button>
<button type="button" className="btn btn-warning"><b>Preview</b></button>
<button type="button" className="btn btn-danger" onClick={this.onCancel}><b>Cancel</b></button>