Search code examples
reactjscss-modules

How to use class names with css module style names?


How to add the bootstrap class inside CSS module class in Reactjs.

I tried to add like the below, but it's not working:

<div className="col-sm-2 col-xs-12, {styles.divide}">

Solution

  • As the value of css module style name is string, you can simply do like this:

    <div className={`col-sm-2 col-xs-12 ${styles.divide}`}>
    

    The syntax some string ${someVar} is string template literals