I am stuck with a very simple problem. I have login form with username, password and button. In my button handler, I try to get the textinput value. But always get undefined
export default class App extends Component {
state = { username: '', password: '' }
onChangeText = (key, val) => {
this.setState({ [key]: val})
}
render() {
return (
Login Form
this.onChangeText('username', val)}
style={styles.input}
/>
this.onChangeText('password', val)}
style={styles.input}
secureTextEntry={true}
/>
);
}
}
Hope this will solve your problem