I am gathering different values from a series of sequential forms and I am using spreads to pass this information along each step. The issue is that I am struggling to create the data format I wish. How should I structure the spread to the following?
I am trying to create this:
{
[
"Your details": {
"name": "value",
"email": "value",
"mobile": "value",
},
"Payment details": {
"cardnumber": "value",
"cardname": "value",
"expire": "value",
"security": "value",
},
"Billing address": {
"cardnumber": "value",
"cardname": "value",
"expire": "value",
"security": "value",
},
]
}
I am using the following spread:
var value = this.refs.form.getValue()
if (value) {
let formValues = { ...this.props.navigation.state.params.form, ['Payment']: { ...value } }
}
The result is:
{
"name": "value",
"email": "value",
"mobile": "value",
"Payment": {
"cardnumber": "value",
"cardname": "value",
"expire": "value",
"security": "value",
},
"Billing address": {
"cardnumber": "value",
"cardname": "value",
"expire": "value",
"security": "value",
},
}
Thank you in advance.