Reputation: 47
I believe I have seen examples of this that answer my question in the positive, but this seems very hard to search for and I cannot find it now. Can a react/javascript object child have both a value and more children at the same time?
Basically, this is what I'm trying to do, where header would both a value for its own height, but also have children:
const height = {
header: '100px' {
icon: '20px',
text: '25px'
}
}
Upvotes: 0
Views: 36
Reputation: 43
I don't believe this is possible. You could however try the following:
const height = {
header: { data: '100px',
inner: {icon: '20px', text: '25px'}
}
}
or
const height = {
header: ['100px',
{icon: '20px', text: '25px'}
]
}
Upvotes: 1