[英]Why is this component switching from controlled to uncontrolled? - React
这是我的无状态反应组件:
export default ({acresMin, update}) => (
<div>
<input
onChange={(e) => update({'acresMin': e.target.value})}
placeholder="10"
type="text"
value={acresMin}/>
</div>
)
当我更改input
的值时,我收到此warning
:
Warning: StatelessComponent is changing an uncontrolled input of type text to be controlled. Input elements should not switch from uncontrolled to controlled (or vice versa). Decide between using a controlled or uncontrolled input element for the lifetime of the component.
我正在使用onChange
更新并保存通过props
填充的store
的值。
我怎么不理解这个?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.