DEV Community

Discussion on: Conditional Class Names in React

Collapse
 
strdr4605 profile image
Dragoș Străinu

It is also possible to do

['ui', 'button', !fixed && 'inverted', !!fixed && 'primary']
    .filter(Boolean)
    .join(' ')
Collapse
 
blove profile image
Brian Love

Nice - even better. Thanks!