React引入css的方式有哪几种
# 是什么
在react组件中引入css
# 怎么用
# 方式
- 组件内直接使用行内style
- 编写方便,代码量大
- 组件引入.css文件,className
- 符合日常习惯
- 容易全局污染
- 组件内引入xxx.module.css
- webpack配置module 为true
- css in js
export const SelfLink = styled.div`
height: 50px;
border: 1px solid red;
color: yellow;
`;
<SelfLink title="People's Republic of China">app.js</SelfLink>
# 原理
# FAQ
上次更新: 2021/12/19, 18:05:42