import World from "./World";
export default function Hello(){
return (
<div>
<h1
style={{
color: "#f00",
borderRight: "12px solid #000",
marginBottom: "50px",
opacity: 0.5,
}}
>
Hello
</h1>
<World />
<World />
</div>
);
}
그럼 어떻게 해야하는가?
각 component 의 특화된 css 작성하기
→ CSS 모듈 활용
.box {
width: 200px;
height: 50px;
background-color: blue;
}
import World from "./World";
import styles from "./Hello.module.css"; // add
export default function Hello(){
return (
<div>
<h1
style={{
color: "#f00",
borderRight: "12px solid #000",
marginBottom: "50px",
opacity: 0.5,
}}
>
Hello
</h1>
<div className={styles.box}>Hello</div> // {styles.box} 로 수정
</div>
);
}