react 使用styled-componts

一、安装

c 复制代码
npm i styled-components

二、直接使用

js 复制代码
import React from 'react'
import styled from 'styled-components'
const Node = styled.div`
    color:red;
`

export default function(){
    return (
        <Node>
            this is test content
        </Node>
    );
};

三、官网

https://styled-components.com/docs/basics#getting-started

相关推荐
hunterandroid13 小时前
[鸿蒙从零到一] ArkUI 基础组件实战:Text、Image、Button 与 TextInput
前端
fsssb13 小时前
Chromium 源码学习笔记(五):一次点击,在进入 JS 之前先经历了什么?
前端
hunterandroid13 小时前
WorkManager 可靠性实战:唯一任务、重试与幂等设计
android·前端
鹿目13 小时前
使用 Vant CLI 搭建 UI 组件库:从 H5 到小程序跨平台
前端·javascript
默_笙13 小时前
😭 我花了两小时找了一个数据结构 bug,才把"迷你 Cursor"跑起来,绝望(bushi)
前端·javascript
竹林81813 小时前
wagmi v2 监听合约事件踩坑记:从 `useContractEvent` 到 `watchContractEvent`,我重构了三版才搞定实时数据流
前端·javascript
天若有情67314 小时前
纯HTML+Tailwind单页作品集网站——零框架静态前端完整源码
前端·html
WebGirl14 小时前
H5唤起app前端实现方案
前端
heimeiyingwang14 小时前
【架构实战】SQL注入与XSS防御:常见Web漏洞的系统性修复
前端·sql·架构
xingcheng14 小时前
Vue 2 + JavaScript编码规范skill
javascript