score:0

   <div className={`anyClass ${props.type==='extra' ? 'extra' : null}`}/>

score:0

import styles from './alert.module.css'
import cn from 'classnames'

export default function Alert({ children, type }) {
  return (
    <div
      className={cn({
        [styles.success]: type === 'success',
        [styles.error]: type === 'error'
      })}
    >
      {children}
    </div>
  )
}

score:0

function Foo () {
  // nothing special about styles.item. it's just a string.
  const classes = props.type === 'extra'
    ? `${styles.item} ${styles.extra}`
    : styles.item;

  return classes;
}

score:0

    <MenuItem name="test product" type="extra"  className = {() => {getStyleClass()}}/>

Related Query

More Query from same tag