styled-components

编程之家收集整理的这个编程导航主要介绍了styled-components编程之家,现在分享给大家,也给大家做个参考。

styled-components 介绍

style-components是针对react写的一套css in js框架,简单来讲就是在js中写css。相对于与预处理器(sass、less)的好处是,css in js使用的是js语法,不用重新再学习新技术,也不会多一道编译步骤。无疑会加快网页速度。如果有sass或less的开发经验,几分钟就可以学会style-components。  

styled-components与react(针对web)和react Native兼容。

 

安装

npm install styled-components@beta

例子

import react from 'react';

import styled from 'styled-components';

// Create a <Title> react component that renders an <h1> which is

// centered,palevioletred and sized at 1.5em

const Title = styled.h1`

font-size: 1.5em;

text-align: center;

color: palevioletred;

`;

// Create a <Wrapper> react component that renders a <section> with

// some padding and a papayawhip background

const Wrapper = styled.section`

padding: 4em;

background: papayawhip;

`;

// Use them like any other react component – except they're styled!

<Wrapper>

<Title>Hello World,this is my first styled component!</Title>

</Wrapper>

网站地址:https://styled-components.com react css-in-js styled-components css

GitHub:https://github.com/styled-components/styled-components

网站描述:针对React写的一套css in js框架

styled-components

官方网站:https://styled-components.com react css-in-js styled-components css

小编说

以上是编程之家为你收集整理的styled-components全部内容。

如果觉得编程之家网站内容还不错,欢迎将编程之家推荐给好友。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


johnny-five,Bocoup 的 JavaScript 机器和物联网编程框架
WePY,一款让小程序支持组件化开发的框架
Deep playground,神经网络的交互式可视化,使用d3.js和TypeScript编写
ShareDB,用于并发编辑系统的前端数据库
RxJS,RxJS 是使用 Observables 的响应式编程的库
egg-react-ssr,最小而美的Egg + React + SSR 服务端渲染应用骨架
Avalon.js,迷你, 易用 ,高性能 的前端MVVM框架
d3-dag,用于可视化有向无环图的布局算法
Guess.js,Google的数据驱动改进前端体验的工具库
hyperapp,创建前端应用的 1 KB 的 JavaScript 库
ITPUB,中国专业的IT技术社区
HTTPie,一个 HTTP 的命令行客户端工具
Inferno,快速、类React风格的js用户界面库
Quasar,基于Vue构建响应式网站和混合移动端 APP
dva, 基于 React 和 redux 的轻量级框架配合 umi 使用后更是降低为 0 API
graphql-yoga,graphql-yoga 全功能的GraphQL服务器,专注于简单的设置,性能和卓越的开发者体验
Next.js,实现react的服务端渲染的框架
IronJS,一个.NET的JavaScript实现
mpvue,基于 Vue.js 的小程序开发框架
react,Facebook开发的一款高效、灵活、声明式设计的JS库