Want to clear the text field in formsy material ui React? If you were using a controlled input (maybe using directly the TextField from Material-ui) – your code would be right, however the FormsyText component handle it’s value internally.
Below is an example:
1 2 3 4 5 6 7 8 9 10 | <FormsyText name="email" ref={(node) => this._emailText = node} validations="isEmail" validationError="Invalid Email" hintText="Email" value={this.state.emailValue} /> //And to clear it this._emailText.setState({ value: "" }) |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.