10 examples of 'react clear input after button click' in JavaScript

Every line of 'react clear input after button click' 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
48function handleClickClear() {
49 onChange('');
50 $input.current.focus();
51}
34onInputClear() {
35 this.setState(() => ({
36 expanded: false,
37 value: '',
38 }));
39}
30_onClearClick () {
31 this.setVal('')
32}
54handleClear(e) {
55 e.stopPropagation();
56 this.props.onClear && this.props.onClear();
57 this.handleChange('');
58}
41clearInput() {
42 ReactDOM.findDOMNode(this.refs.input).value = '';
43}
72_onClear () {
73 const node = ReactDOM.findDOMNode(this)
74 node.value = ''
75}
297value: function onClickClear () {
298 this.setState(function (_ref2) {
299 var count = _ref2.count,
300 countTotal = _ref2.countTotal
301
302 return {
303 isClicked: false,
304 countTotal: countTotal - count,
305 count: 0
306 }
307 })
308}
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}
202onClickClearButton () {
203 this.props.onChange(null, true, true)
204}
603clearValue() {
604 this.setState({ value: undefined });
605}

Related snippets