[英]how to put state into value in Autocomplete in MaterialUi React
I have Autocomplete and a reset button.我有自动完成和重置按钮。 I need that pressing the button my state was reset.
我需要按下按钮我的 state 被重置。 So I need to use state as a value in Autocomplete.
所以我需要使用 state 作为自动完成中的值。 Can I do it?
我可以做吗? (state.type="") I use class components
(state.type="") 我使用 class 组件
<Autocomplete
className={classes.root}
id="combo-box-demo"
options={availableTypes}
getOptionLabel={(option) => option.title}
onChange={this.changeType}
renderInput={(params) => (
<TextField
className={classes.wrapper}
{...params}
label="choose any type"
/>
)}
/>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.