ReactJS clear input value (can not use submit) after button click
Your input is controlled input. You have value set to be value={this.state.value} and handle change function is:
handleChange(event) { this.setState({value: event.target.value}); }
so if you want to reset this input, your reset function would simply set that state.value to be an empty string.
reset = () => {
this.setState({value: ""});
};
If your input would be uncontrolled (so value and onChange would not be provided) you could change it by accessing it through Ref. (see React.createRef).
Clear input text after click event
I am surprised that this even works the first time. With controlled components in react (ones where you are setting the value like you are with your input). you need to update the value whenever the user changes the text (with the onChange() event).
I made a JS fiddle here with your original code and you can see you can't even update the value in the input. In order to get it to update you need to replace the onBlur event with an onChange event like this JS fiddle. Hope that helps!
Related Topics
How to Move Focus on Next Field When Enter Is Pressed
How to Import File from Public Folder in React Application
Show Base64 Pdf Data Using Window.Open on Chrome New Version
How to Save .Xlsx Data to File as a Blob
Open File Explorer Window from JavaScript
Check If a String Has White Space
Check If a String Is a Date Value
How to Manage Hide and Show Multiple Div and Sections Using Jquery
Html Input File Selection Event Not Firing Upon Selecting the Same File
How to Add Multiple Values in Json Object and Get an Updated Json File
How to Get Around .Push Is Not a Function in JavaScript
What Does This Format Means T00:00:00.000Z
How to Add Node Module to Angular Project If Is Not Schematics Enabled
Filter/Search from the Drop-Down List of Options Using Angular
How to Remove Special Character from Json Without Parsing
Jquery Validate Phone Number With With Regex
Split a String Only the At the First N Occurrences of a Delimiter