I\'m adding some validation to the input text of a TextInput component. The TextInput\'s value is handled in the state and is only updated when the value entered is valid.
you can try to use '=>' operator
class TextInputWithValidation extends Component {
constructor(props) {
super(props);
this.state = { text: ''}
this.handleChange = this.handleChange.bind(this);
}
//here
handleChange = (text) => {
if(isValid) {
this.setState({text})
}
}
render() {
return (
this.handleChange}
/>
)
}
}