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

相关推荐
Halo_tjn1 小时前
基于封装的专项 知识点
java·前端·python·算法
摘星编程1 小时前
OpenHarmony环境下React Native:自定义useTruncate文本截断
javascript·react native·react.js
Duang007_2 小时前
【LeetCodeHot100 超详细Agent启发版本】字母异位词分组 (Group Anagrams)
开发语言·javascript·人工智能·python
2601_949868363 小时前
Flutter for OpenHarmony 电子合同签署App实战 - 主入口实现
开发语言·javascript·flutter
m0_748229993 小时前
Vue2 vs Vue3:核心差异全解析
前端·javascript·vue.js
2601_949593654 小时前
高级进阶React Native 鸿蒙跨平台开发:LinearGradient 背景渐变与主题切换
react native·react.js·harmonyos
C澒4 小时前
前端监控系统的最佳实践
前端·安全·运维开发
xiaoxue..4 小时前
React 手写实现的 KeepAlive 组件
前端·javascript·react.js·面试
摘星编程4 小时前
在OpenHarmony上用React Native:自定义useHighlight关键词高亮
javascript·react native·react.js
hhy_smile4 小时前
Class in Python
java·前端·python