c8r/lab

Using props to determine styles

fazouane-marouane opened this issue · 2 comments

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

Hi @fazouane-marouane,

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" }'

Thanks it works like a charm!