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 })} />

Set the default value value=(state.no ||'')

Guess you like

Origin blog.csdn.net/slwsss/article/details/103802353