How to add multiple classes in Material UI using the classes props

后端 未结 11 2023
花落未央
花落未央 2020-12-23 15:39

Using the css-in-js method to add classes to a react component, how do I add multiple components?

Here is the classes variable:

const styles = theme          


        
11条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-23 16:33

    As already mentioned, you can use string interpolation

    className={`${this.props.classes.container}  ${this.props.classes.spacious}`}
    

    And you can try classnames library, https://www.npmjs.com/package/classnames

提交回复
热议问题