I have a problem, when I put the user : 1 and password 123 appears to me in console empty strings and I do not understand why someone can help me?
export default class App extends React.Component {
// Setting up Login Activity title.
constructor(props) {
super(props)
this.state = { UserName: '',Userpassword: ''}
this.login = this.login.bind(this);
this.onChange = this.onChange.bind(this)
}
onChange(e) {
this.setState({ [e.target.name]: e.target.value });
console.log(this.state);
}
<TextInput
placeholder="Enter User Name"
onChange={this.onChange}
underlineColorAndroid='transparent'
style={styles.TextInputStyleClass}
/>
<TextInput
placeholder="Enter Password"
onChange={this.onChange}
underlineColorAndroid='transparent'
style={styles.TextInputStyleClass}
secureTextEntry={true}
/>
I add a friend of the console output of my code, user: 1 , password:123ยด
my Out