Hi all
Is it possible to write an expression in jsx attribute? For example:
<li className="nav-item {active}" title={title}/>
active
is an expression.
Thanks
Hi all
Is it possible to write an expression in jsx attribute? For example:
<li className="nav-item {active}" title={title}/>
active
is an expression.
Thanks
Alsot, It possible to write
let active = "nav-item-active";
<li className={j|nav-item $active|j} title="title" />;
The interpolated must be only a variable. Not expression
https://bucklescript.github.io/docs/en/interop-cheatsheet.html#string-unicode-interpolation
If you are doing a lot of conditional className
stuff you might want to check out this small/simple but awesome library from @alexfedoseev… https://github.com/alexfedoseev/re-classnames