The following code discovers the value prop of the Textfield does not get updated programmatically. The clear() function should reset the value of the Textfiled to empty string.
<IconButton name="clear" className="blue" onClick={() => this.clear()}/>
<Textfield
onKeyUp={(e) => this.onKeyUp(e)}
label="Search Address, city, zip"
expandable
expandableIcon="search"
floatingLabel
value={this.state.searchText} />
onKeyUp(e) {
const term = e.target.value
this.setState({
searchText: term
})
if (e.keyCode === 13) {
// do stuff
}
}
clear() {
this.setState({
searchText: ''
})
}
The following code discovers the
value
prop of theTextfield
does not get updated programmatically. Theclear()
function should reset the value of the Textfiled to empty string.