React : CSS class name import not working

后端 未结 15 1574
轻奢々
轻奢々 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条回答
  •  旧时难觅i
    2020-12-31 20:48

    To use class names like an object you need to do 2 things:

    1. Write import like import * as classes from './Layout.css';
    2. Include typings defenition for your style.

    Example for Typescript - create Layout.css.d.ts file with export const Content: string;

    Be sure that you define camelCase option for css-loader to resolve dash-classes into camel-case properties that you define in Layout.css.d.ts.

提交回复
热议问题