style-stateful:一个React高阶组件封装样式状态

时间:2021-04-29 04:32:42
【文件属性】:
文件名称:style-stateful:一个React高阶组件封装样式状态
文件大小:17KB
文件格式:ZIP
更新时间:2021-04-29 04:32:42
react css higher-order-component hoc css-components 有状态的 一个React高阶组件封装样式状态 基本原理 在开发Presentational组件时,通常我们必须处理将组件的props / state转换为一组css类的机制。 StyleStateful hoc的目标是将该机制隔离到一个类似函数的reducer中,该函数会将组件的状态和props映射到一组CSS状态。 例子 考虑以下组件: @StyleStateful(mapPropsToStyleState) class MyFancyInput extends React.Component { render () { return
<input css-ref = 'fancy__input'
【文件预览】:
style-stateful-master
----.gitignore(119B)
----tsconfig.json(329B)
----README.md(2KB)
----LICENSE(11KB)
----package.json(2KB)
----src()
--------StyleStateful.d.ts(2KB)
--------StyleStateful.js(4KB)
--------StyleStateful.spec.tsx(5KB)
----.babelrc(342B)
----build()
--------checkstyle()
--------config()
--------goals()
----index.js(129B)
----index.d.ts(129B)
----.npmignore(12B)
----.travis.yml(710B)
----.editorconfig(266B)
----gulpfile.babel.js(170B)

网友评论