s-ol’s Twitter Archive
—№ 1,332
⇤ Newest
Tweet
⇠ Newer
Tweet
Older
Tweet
⇢
little trick for #reactjs classNames using #es6 tagged template literals: const c = (...[[const_cs, ...var_cs], ...exprs]) => ( const_cs + var_cs.map((cs, i) => exprs[i] ? cs.trim() : '').join(' ') ); c
fixed ${true}cond ${false}these removed
; // -> 'fixed cond'
On twitter.com
♻️ 2
Retweets
❤️ 1
Favorite
2019 Apr 4
Mood +
2
🙂
…in reply to @S0lll0s
every ${condition-expr} decides whether the classes following it are included or omitted. Fixed classes can be put before the first condition.
Permalink
On twitter.com
2019 Apr 4
Mood
0