reactjsbabel-plugin-react-css-modules

Pass className as other prop than styleName


How do I pass a CSS module class name as a different prop than styleName?

import './MyStyles.css'

<ThirdPartyComponent
  styleName='this-works'
  activeClassName='i want to pass my css module classes here' />

Solution

  • import styles from './MyStyles.css'
    
    <ThirdPartyComponent
        className={styles['this-works']}
        activeClassName={styles['my-css-module-class-name']}
    />