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

相关推荐
RobinDevNotes1 小时前
从 Electron 到 GPUI,9 个跨平台桌面方案该怎么选
前端·javascript·rust·electron·openresty·前端开发工具
程序员大阳1 小时前
HTML+CSS+JS对话式实战(6)-学生端查看活动功能开发
javascript·css·html·模块·查看学生
jay神2 小时前
基于 YOLOv8 的轴承缺陷检测(Web 版)
前端·人工智能·yolo
jay神2 小时前
基于 YOLOv8 的森林火灾检测系统(Web 版)
前端·yolo
code2cat2 小时前
HTML基础篇之第一张网页:从index.html到浏览器里的任务清单
前端·html
miss3 小时前
AI 改完不敢上线?OpenSpec 规约驱动开发实战
前端·代码规范·前端工程化
AiMan3 小时前
腾讯ima还是不可以导出左侧所有对话,只能单条导出,方法不对吗
前端
去伪存真3 小时前
并发量一高就装死?Agent 全链路“防猝死”手册
前端·agent
Moment4 小时前
AI 编程时代,聊聊我的 Mac mini 双屏桌面
前端·后端
AiMan4 小时前
先确认能不能一次把Microsofat Copilot所有内容打包一个文件导出
前端