I am trying do loop over a prop and push the parent and child to a variable. I seem to be able to get the looping and pushing working correctly, but its pushing all the children under each parent
var options = [];
var option = [];
Object.keys(this.props.data.options).forEach((key, index) => {
options.push(
<AddToCartRow key={index} option={key} options={option} cartKey={this.props.cartKey} />,
Object.values(this.props.data.options[key]).forEach((value, index) => {
option.push(value)
})
)
})
Below is what is currently happening
The expected result should be
size - 0[price: 3.95, title: Small] - 1 [price: 4.95, title: Large]
blend - 0[price: 0, title: Regular] - 1 [price: 0, title: Decaf]
etc
