react-scoped-styles:React的作用域样式源码免费下载
【资源属性】:资源名称:react-scoped-styles:React的作用域样式源码
资源大小:15KB
资源类别: 源码下载 》 其它源码
更新时间:2021-06-30
资源语言:简体中文
授权方式:免费下载
使用平台:Windows/Linux/Mac
下载地址:下载地址
资源介绍:
React的作用域样式源码获取由组件目录界定CSS类它与CSS模块有何不同?
在CSS模块中,您必须手动导入和分配类
import styles from './button.styl' ; const Button = ( ) => ( < button className = { styles . foo } > Press Me < / button > ) ; React Scoped Styles不需要更改常规的样式工作流程。您仍然使用纯字符串分配类。 import './button.styl' ; const Button = ( ) => ( < button className = "foo" > Press Me < / button > ) ;
安装
npm i react-scoped-styles
用法
该模块假定组件文件及其样式在同一目录中。