https://create-react-app.dev/docs/adding-a-css-modules-stylesheet
App.js 에서 .css 를 주석처리
// import './App.css';
import styles from "./App.module.css";
console.log(styles);
// App: "App_App__2jMOo"
//
// "App-logo-spin": "App_App-logo-spin__1cnzV"
//
// header: "App_header__3tTQB"
//
// link: "App_link__1hoyD"
//
// logo: "App_logo__3HjxY"
CSS Modules 로 import 하게 되면 **[filename]\_[classname]\_\_[hash]**
다른 어떤 것과 겹치지 않을만한 hash 값으로 ./App.module.css 에서 작성된 값들을
대체한다.
// ./App.module.css
// 브라우저에서 확인해보면 아래처럼 hash 값이 추가된 걸 볼 수 있다.
.App { // --> **.App_App__2jMOo**
text-align: center;
}
.App .logo { // --> **.App_App__2jMOo .App_logo__3HjxY**
height: 40vmin;
pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
.App .logo {
animation: App-logo-spin infinite 20s linear;
}
}
.App .header {
background-color: #282c34;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
}
.App .link {
color: #61dafb;
}
@keyframes App-logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}