[TypeStyle] Reusable styles using TypeStyle mixins
Posted Answer1215
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[TypeStyle] Reusable styles using TypeStyle mixins相关的知识,希望对你有一定的参考价值。
TypeStyle’s style function allows you to give multiple objects as an argument. This provides a simple extensible reuse-ability model. We cover typestyle mixin and mixin creators in this lesson. We also demonstrate that you have the full power of javascript at your disposal when using TypeStyle.
import { style } from ‘typestyle‘; import * as React from ‘react‘; import * as ReactDOM from ‘react-dom‘; const fontSize = (value: number | string) => { const valueStr = typeof value === ‘string‘ ? value : value + ‘px‘; return { fontSize: valueStr } }; const className = style( fontSize(‘3em‘), {color: ‘red‘} ); ReactDOM.render( <div className={className}> Hello Typestyle </div>, document.getElementById(‘root‘) );
以上是关于[TypeStyle] Reusable styles using TypeStyle mixins的主要内容,如果未能解决你的问题,请参考以下文章
[RxJS] Reusable multicasting with Subject factories
通过hadoop配置文件快速构建可reusable的Hadoop fs
UITableViewCell (Reusable Cell) 没有识别正确的约束
Working With Playbooks--Creating Reusable Playbooks
[Recompose] Make Reusable React Props Streams with Lenses
java http://li2.me/2016/08/make-a-reusable-ui-in-android-app-development.html