there is a state value
savedData:{
firstName: '',
lastName: '',
mobile: '',
email: '',
password: '',
forgotPassword: '',
checkbox1: false,
checkbox2: false
}
Text inputs and checkbox are in a flat list, each text input and checkbox is rendered in each cell. How can I update a value of checkbox in the array by index when onClick of checkbox is called, without using state variables or global variables?
i am updating text input values as shown below
<Input
placeholder={item.key}
placeholderTextColor={'grey'}
onChangeText={this.updateText.bind(this,item.key)}
onSubmitEditing={ (event) => console.log(event)}
underlineColorAndroid="transparent"
/>
updateText(text,key){
var change = this.state.savedData;
var string1 = key;
change[text] = string1;
this.setState({ savedData: change });
}
How can I update checkbox1 and checkbox2 values by index or based on key without using state variables or global variables and update in savedData object.