10 examples of 'react clear input' in JavaScript

Every line of 'react clear input' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
41clearInput() {
42 ReactDOM.findDOMNode(this.refs.input).value = '';
43}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

54clear() {
55 this.setState({ value: '' });
56
57 // trigger onchange event on input
58 this.inputNode.value = '';
59 this.onChange({ currentTarget: this.inputNode });
60 this.inputNode.focus();
61}
603clearValue() {
604 this.setState({ value: undefined });
605}
38clearValue() {
39 this.props.onChange('');
40}
43clearInput() {
44 this.setState({value: ''});
45 this.onChangeText('');
46}
72_onClear () {
73 const node = ReactDOM.findDOMNode(this)
74 node.value = ''
75}
48function handleClickClear() {
49 onChange('');
50 $input.current.focus();
51}
660value: function clearInputValue() {
661 this.props.onInputChange('');
662 }
40clear() {
41 var event = {
42 FAKE_EVENT: true,
43 target: this.input,
44 };
45 this.input.value = '';
46 this.onChange(event);
47}
54handleClear(e) {
55 e.stopPropagation();
56 this.props.onClear && this.props.onClear();
57 this.handleChange('');
58}

Related snippets