Aphrodite is a library styling React components.

You get all the benefits of inline styles (encapsulation, no build step, no CSS cascade, building up styling with JavaScript instead of a preprocessor language) with all the benefits of CSS (animations and transitions, pseudo-classes, media queries).

Learn how to use Aphrodite to style reusable React components.

import React, { Component } from 'react'
import { StyleSheet, css } from 'aphrodite' const styles = StyleSheet.create({
button: {
backgroundColor: '#1f8dd6',
border: ,
borderRadius: ,
color: '#fff',
outline: ,
padding: , ':active': {
boxShadow: '2px 2px 2px 1px rgba(0, 0, 0, 0.2)'
}, ':hover': {
backgroundColor: '#1cb841'
},
}
}) class Button extends Component {
render() {
return (
<button className={css(styles.button)} onClick={this.props.onClick}>
{this.props.children}
</button>
)
}
} export default Button;

[React] Styling React Components With Aphrodite的更多相关文章

  1. 【转】Facebook React 和 Web Components(Polymer)对比优势和劣势

    原文转自:http://segmentfault.com/blog/nightire/1190000000753400 译者前言 这是一篇来自 StackOverflow 的问答,提问的人认为 Rea ...

  2. [React Fundamentals] Composable Components

    To make more composable React components, you can define common APIs for similar component types. im ...

  3. [React] React Router: Named Components

    In this lesson we'll learn how to render multiple component children from a single route. Define a n ...

  4. Facebook React 和 Web Components(Polymer)对比优势和劣势

    目录结构 译者前言 Native vs. Compiled 原生语言对决预编译语言 Internal vs. External DSLs 内部与外部 DSLs 的对决 Types of DSLs - ...

  5. [React] 09 - Tutorial: components

    jsx变为js的过程:http://babeljs.io/repl/ youtube: https://www.youtube.com/channel/UCA-Jkgr40A9kl5vsIqg-BIg ...

  6. 小谈React、React Native、React Web

    React有三个东西,React JS 前端Web框架,React Native 移动终端Hybrid框架,React Web是一个源码转换工具(React Native 转 Web,并之所以特别提出 ...

  7. 重谈react优势——react技术栈回顾

    react刚刚推出的时候,讲react优势搜索结果是几十页. 现在,react已经慢慢退火,该用用react技术栈的已经使用上,填过多少坑,加过多少班,血泪控诉也不下千文. 今天,再谈一遍react优 ...

  8. React 与 React Native 底层共识:React 是什么

    此系列文章将整合我的 React 视频教程与 React Native 书籍中的精华部分,给大家介绍 React 与 React Native 结合学习的方法,此小节主要介绍 React 的底层原理与 ...

  9. 《React Native 精解与实战》书籍连载「React 与 React Native 简介」

    此文是我的出版书籍<React Native 精解与实战>连载分享,此书由机械工业出版社出版,书中详解了 React Native 框架底层原理.React Native 组件布局.组件与 ...

随机推荐

  1. H264相关知识

    1.基本概念 I frame :帧内编码帧 又称intra picture,I 帧通常是每个 GOP(MPEG 所使用的一种视频压缩技术)的第一个帧,经过适度地压缩,做为随机访问的参考点,可以当成图象 ...

  2. 应用市场高速下载以及网页端调起APP页面研究与实现

    Github博文地址,此处更新可能不是很及时. 好久没写博客了,好大一个坑.正好,最近刚做完应用市场的高速下载功能,便拿来填了这个坑. 话说产品为了增加用户量,提升用户活跃度以及配合推广,更坑爹的是看 ...

  3. POJ 2386 Lake Counting

    Lake Counting Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 28966   Accepted: 14505 D ...

  4. 基于Fragment实现Tab的切换,滑出侧边栏

    最近在学习Fragment(碎片)这是android3.0以后提出的概念,很多pad上面的设置部分都是通过Fragment来实现的,先看看具体的效果吧(图一)  (图二) (图三)第一章图片是初始时的 ...

  5. duilib中的V和H布局中滚动条问题

    转自博客:http://blog.csdn.net/damingg/article/details/41149037 首先看一段xml代码 [html] view plaincopy <?xml ...

  6. 【原】Mongodb相关资料

    Mongodb与关系型数据库对比 Mongodb与关系型数据库对比 由于之前主要接触的是关系型数据库,所以主要将Mongodb与关系型数据库进行对比:主要从术语.Server与Client.数据定义语 ...

  7. log4net 动态设定日志文件名

    参考文章: http://blog.csdn.net/haoxiaozigang1/article/details/16343303 通过这个篇文章的方法,只能修改文件的路径,文件名并没有修改 参考文 ...

  8. andriod的简单用法2

    1.在Activity中使用menu //创建菜单项 public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this ...

  9. 从python的yield说起

    前段时间在读trac 中wiki模块的源码的时候,发现了很多地方都使用了yiled这一关键词, 感觉是在需要返回某个值的地方通过yield来代替return, 不是很明白其用法,所以仔细研究下. 一个 ...

  10. 关于OpenCV做图像处理内存释放的一些问题

    转载:http://blog.sina.com.cn/s/blog_67a7426a0101czyr.html 工程运行,发现内存持续增长,到一定的时候就发生了内存泄漏. 内存泄露的定义 内存泄露是说 ...