Recommended Way of adding multiple classes in css modules

When using css modules to import css into your js components, you can follow the following ways to add multiple classes to the element.

import styles from './style.css'
...
return <div classNames={[styles.btn, styles.btnPrimary, styles.pullRight].join(' ')} />

another approach is to use the classnames library

import classNames from "classnames";
import styles from "./style.css";

let className = classNames(styles.btn, {
  [styles.primary]: this.props.primary,
  [styles.right]: this.props.right
});
return <div className={className} />