Using props to determine styles
fazouane-marouane opened this issue · 2 comments
fazouane-marouane commented
Hi,
Is there a way to use props values to determine styles?
I would have expected the following to work color: this.props.stuff? 'red': 'blue'
. But it doesn't.
Can you explain how would one can achieve such a thing? Thanks.
mrmrs commented
That concept does work, but you need some additional syntax. Here is your example rewritten. Let me know if you have any additional questions!
color: '${ props.stuff? "red" : "blue" }'
fazouane-marouane commented
Thanks it works like a charm!