在表单中,报如下的错,意思是非受控的输入框变成了受控的,报错信息如下 Warning: A component 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 uncontrolle
受控组件:通过组件的状态与属性的改变来控制组件 不可控组件:直接通过底层的dom来控制组件(具体来说就是通过绑定再底层dom上的方法来实现的,比如说ref,onChange) 受控组件 function validate(name, email, password) { // we are going to store errors for all fields // in a signle array const errors = []; if (name.length === 0) { er