Is it possible to decide which property in object is going to be defined depending on condition? For example:
props="{
'prop1': {label: 'Prop1'},
hasProp2 ? '(prop2': {label: 'Prop2'}) : ('prop3': {label: 'Prop3'}),
'prop4': {label: 'Prop4'}
}"
And let's say hasProp2
is computed property
with a function which returns true
or false
. How can I use ternary operator
or basic if statement
inside object or is it even possible?