简体   繁体   中英

CSS-In-Js Using aphrodite style object with string class names on one html element

My existing project using Bootstrap and looks like:

<ul className=”nav navbar-nav”>

But Aphrodite asks for something like:

<ul className={css(styles.red)}>

Question:

How can I merge these 2 approaches?

<ul className=”nav navbar-nav” className={css(styles.red)}>

You can use ES6 template literal:
className={`nav navbar-nav ${css(styles.red)}`}

or the join() method:
className={['nav navbar-nav',css(styles.red)].join(' ')}

example: https://codesandbox.io/s/o7l833lym6

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM