I'm getting an odd error with object inside an object in React Native. I set some state variables in my constructor:
this.state = {
payAmount: 0,
selectedPaymentMethod: 0,
btnDisabled: true,
cardDetails: {
cardName: '',
cardNumber: '',
cardCVV: '',
cardExpiration: '',
cardPostalCode: ''
}
};
Then, when I try to access "cardDetails", it returns Can't find variable: cardName
Code:
const data = { cardName, cardNumber, cardCVV, cardExpiration, cardPostalCode } = this.state.cardDetails;
Can't I use object inside an object in react native?
Thank you!