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. IOS UIActivityIndicatorView 等待指示器

    自己做的一个 等待指示器 #import <UIKit/UIKit.h> @interface RockIndicatorView : UIView { } @property(nonat ...

  2. 《Python CookBook2》 第一章 文本 - 测试一个对象是否是类字符串 && 字符串对齐

    测试一个对象是否是类字符串 任务 有时候需要测试一个对象,尤其是当你在写一个函数或者方法的时候,经常需要测试传入的参数是否是一个字符串. 解决方案 利用内建的isinstance 和basestrin ...

  3. 通过gdb调试分析Linux内核的启动过程

    作者:吴乐 山东师范大学 <Linux内核分析>MOOC课程http://mooc.study.163.com/course/USTC-1000029000 一.实验流程 1.打开环境 执 ...

  4. bzoj 2186 [Sdoi2008]沙拉公主的困惑(欧拉函数,逆元)

    [题目链接] http://www.lydsy.com/JudgeOnline/problem.php?id=2186 [题意] 若干个询问,求1..n!中与m!互质的个数. [思路] 首先有gcd( ...

  5. commons-lang3-3.4.jar

    StringUtils 1.StringUtils.isBlank(str); 检查字符串是否为空白(“ ”),为空(“”),为null. * StringUtils.isBlank(null)    ...

  6. Java访问USB设备

    最近在用Java访问RDing设备,使用的是Java HID API.使用过程中发现一个问题,由于是嵌入式小白,不知道如何向USB设备发送report.于是想到可以看看自带的软件如何访问USB的.找到 ...

  7. POJ 2185 Milking Grid(KMP)

    Milking Grid Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 4738   Accepted: 1978 Desc ...

  8. java多线程中的volatile和synchronized

    package com.chzhao; public class Volatiletest extends Thread { private static int count = 0; public ...

  9. [iOS微博项目 - 1.5] - NavigationBar标题按钮

    A.NavigationBar标题按钮 1.需求 在“首页”的导航栏中部设置一个“首页”文字+箭头按钮 统一设置样式 根据实际文本长度调整宽度 消除系统自带的点击高亮效果 点击按钮,箭头上下颠倒 gi ...

  10. Linux使用locate命令定位文件

    FIND命令 很多Linux用户喜欢使用find命令来查找文件,例如他们通常喜欢这样做: find / -name 'pattern' 确实find的强大功能不仅仅用来查找文件,它能用来定位更加细节的 ...