将 className 作为 styleName 以外的其他道具传递
Pass className as other prop than styleName
如何将 CSS 模块 class 名称作为不同于 styleName
的 prop 传递?
import './MyStyles.css'
<ThirdPartyComponent
styleName='this-works'
activeClassName='i want to pass my css module classes here' />
import styles from './MyStyles.css'
<ThirdPartyComponent
className={styles['this-works']}
activeClassName={styles['my-css-module-class-name']}
/>
如何将 CSS 模块 class 名称作为不同于 styleName
的 prop 传递?
import './MyStyles.css'
<ThirdPartyComponent
styleName='this-works'
activeClassName='i want to pass my css module classes here' />
import styles from './MyStyles.css'
<ThirdPartyComponent
className={styles['this-works']}
activeClassName={styles['my-css-module-class-name']}
/>