這裏是我的無狀態的反應成分:爲什麼此組件從受控制切換到非受控制? - 陣營
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
更新和保存值store
正在填充通過props
。
我對此不甚瞭解?