I am trying to update the state in react app
state = {
pickupAddress: {
country: '',
city: '',
zipCode: '',
street: '',
},
deliveryAddress: {
country: '',
city: '',
zipCode: '',
street: '',
},
parcel: {
type: '',
height: '',
width: '',
length: '',
weight: '',
quantity: '',
},
};
The problem that i am facing is i cannot reach inside of the object with e.target.pickupAddress.city
for example.
This is my onChange method
onChange = (e) => this.setState({[
e.target.pickupAddress.country]: e.target.pickupAddress.country
});