Reset form using AvForm in react js
Solution 1:
You can get the ref
from AvForm
and use reset()
class Whatever extends React.Component {
constructor(props){
super(props);
this.handleValidSubmission = this.handleValidSubmission.bind(this);
}
handleValidSubmission (event, fields) {
// do your thing
this.form && this.form.reset();
}
render() {
return (
<AvForm onValidSubmit={this.handleValidSubmission} ref={c => (this.form = c)}>
...
Your form fields here
...
</AvForm
)
}
}
Solution 2:
Hassam use the concept of states and set the state to empty whenever it is required and assign that state to the value property of field