React code:
const [state, setState] = useState({login:'', password: ''});
const changeHandler = (e) =>{
setState({[e.target.name]: e.target.value});
}
return(
<div className='login-wrapper'>
<form onSubmit={(e) => submitHandler(e)}>
<Input color='primary'
margin='dense'
placeholder='login'
type='text'
style={{margin:'20px', width:'300px'}}
name='login'
value={state.login}
onChange={(e) => changeHandler(e)}/>
</form>
</div>)}
Error:
A component is changing a controlled input of type password to be uncontrolled. Input elements should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled input element for the lifetime of the component.