javascript - 在 React 中链接样式的一些解决方案?
问题描述
在使用css-modules做出反应时,我将类分配给这样的组件
import styles from './styles.module.css'
const SomeComponent = () => (
<ChildComponent className={styles.SomeClass + ' ' + styles.AnotherClass} />
)
或者我可以这样分配
<ChildComponent className={`${styles.SomeClass} ${styles.AnotherClass}` />
您能否建议如何转换样式变量的方式,我们可以像这样分配类
<ChildComponent className={styles.SomeClass.AnotherClass.OneMoreClass />
当然,我们可以使用一两个或尽可能多的类
解决方案
推荐阅读
- jenkins - 了解 Jenkins 管道电子邮件代码
- python - 意外错误:WHERE 参数“未定义”的“未定义”值无效
- jquery - 通过 .blur jquery 访问每个类元素并将其发送到控制器
- scala - scalafmt 类,方法参数意图
- python - 如何根据另一个数组中的值从初始数据中删除特定行?
- ios - Dismiss 使跳转视图控制器 Swift
- java - 如何在硒中模拟真正的按键输入动作?
- c# - BackgroundService 中的阻塞调用使另一个 BackgroundService 无法运行
- python - Beautiful Soup 网页抓取:我如何抓取这个特定的 html 结构
- r - 如何为 R 中的 plm(池)模型计算 stargazer 中的稳健标准误差?