You have to assign the value for input element. To clear the value just reset the state variable.
this.setState({ email: "" });
Here is the small code for you
class App extends Component {
constructor(props) {
super(props);
this.state = {
inputVal: "Clue Mediator"
};
this.onInputChange = this.onInputChange.bind(this);
this.clearInput = this.clearInput.bind(this);
}
clearInput() {
this.setState({ inputVal: "" });
}
// handle input change event
onInputChange(e) {
this.setState({ inputVal: e.target.value });
}
render() {
return (
<>
<input
placeholder="Enter your value here..."
value={this.state.inputVal}
onChange={this.onInputChange}
/>
<input type="button" value="clear" onClick={this.clearInput} />
</>
);
}
}
Here is the working demo for you
https://codesandbox.io/s/autumn-darkness-rybj2
Hope this will work for you!