React : CSS class name import not working

后端 未结 15 1512
轻奢々
轻奢々 2020-12-31 20:16

i have a

div in my react component and im importing some class name from a class css file, but the class name is not getting integrated to the main
15条回答
  •  生来不讨喜
    2020-12-31 20:46

    None of the above solutions worked for me, if you're using a react version with react-scripts@2.0.0 and higher, they probably wouldn't work for you either.

    you must used the CSS Modules alongside regular stylesheets using the [name].module.css file naming convention. CSS Modules allows the scoping of CSS by automatically creating a unique classname of the format [filename]_[classname]__[hash].

    example Header.module.css nb: header here can be any name

提交回复
热议问题