Answers for "clear input when into to component react"

2

clear input file html react

e.target.value = null;
Posted by: Guest on March-08-2020
0

react clear input after button click

<script type="text/babel">
    var StateComponent = React.createClass({
        resetName : function(event){
            this.setState({
                name : ''
            });
        },
        render : function(){
            return (
                <div>
                    <input type="text" value= {this.state.name}/>
                    <button onClick={this.resetName}>Reset</button>
                </div>
            )
        }
    });
    ReactDOM.render(<StateComponent/>, document.getElementById('app'));
</script>
Posted by: Guest on September-02-2021

Code answers related to "clear input when into to component react"

Browse Popular Code Answers by Language