On the introduction of css File into react

problem description

is to introduce import". / style.css"; into the js file and find that it has no effect

the environmental background of the problems and what methods you have tried

I"ve used styled-components, but I"m not used to it

related codes

/ / Please paste the code text below (do not replace the code with pictures)

...
import "./css/style.css";
...
Mar.24,2022

this has to be aimed at your scaffolding. Some scaffolding can't. You'd better have your own scaffolding so that if something goes wrong, it's easy to find it. I couldn't bring it in when I used the swiper style. Finally, I looked at this man's scaffolding and found that it was only introduced by link.


maybe it was in the wrong position


it should be the scaffolding, for example, if you use antd, then your css introduction should be

    import styles from './css/style.css';

the class name that uses yes needs to be defined as

    className={styles.xxx}

if you don't add styles. , you need : global package
this is an example of scaffolding, depending on what you are using

.
Menu