Expression in the html attribute?



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.



How about…

<li className=("nav-item " ++ active) title=title/>


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


If you are doing a lot of conditional className stuff you might want to check out this small/simple but awesome library from @alexfedoseev…