A component is changing an uncontrolled input of type undefined to be controlled

A component is changing an uncontrolled input of type undefined 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.

<input value={state.no} onChange={e => this.setState({ no: e.target.value })} />

设置默认值 value={state.no || ''}

猜你喜欢

转载自blog.csdn.net/slwsss/article/details/103802353
今日推荐