A
A
ART42020-08-31 17:21:21
React
ART4, 2020-08-31 17:21:21

One character input in onChange???

Good afternoon, tell me why the input goes one character at a time?
input:

<input type="text" name="loginUser" value={props.loginUser} onChange = {props.LoginUserName} placeholder="Логин"/>

FunctionLoginUserName:
LoginUserName = e => {
      this.setState({  
        loginUser: e.target.value  
      }); 
    }

State:
this.state = {
   loginUser: ""
}

At each letter of input, gets off. When entering data, each time you need to click on input and continue writing...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Shcherbakov, 2020-08-31
@Simply1993

It was probably necessary to show the entire component)
Why do you take value from props, and not from state? Or is it not just one component?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question