【文件属性】:
文件名称:react-props-classnames:轻松将组件的props转换为类名
文件大小:59KB
文件格式:ZIP
更新时间:2021-05-14 23:56:17
react javascript styled-components JavaScript
React Props类名
轻松将组件的props转换为类名
当您想通过道具控制样式时,可以很好地与styled-components一起使用。
将您的布尔值和字符串属性转换为className。
自定义的classNames前缀。
安装
yarn add react-props-classnames
例子
用法
import styled from 'styled-components' ;
import createPropsTransform from 'react-props-classnames' ;
const propsTransform = createPropsTransform ( {
prefix : 'my-button' ,
props : [ 'circle' , 'size' ] ,
} ) ;
const Button = styled .
【文件预览】:
react-props-classnames-master
----.travis.yml(35B)
----.babelrc(189B)
----package.json(3KB)
----test()
--------configure-enzyme.js(156B)
----src()
--------utils.js(211B)
--------index.js(97B)
--------__tests__()
--------createPropsTransform.js(1KB)
--------PropsTransform.js(1KB)
----.eslintrc.js(322B)
----.gitignore(196B)
----.npmrc(18B)
----README.md(3KB)
----yarn.lock(194KB)
----.eslintignore(26B)
----.editorconfig(186B)