生活不允许普通人内向
我的github: 李大玄
我的私人博客: 李大玄
我的npm开源库: 李大玄
我的简书: 李大玄
我的CSDN: 李大玄
我的掘金: 李大玄
哔哩哔哩: 李大玄
如何在react
中使用 styled-components
语法
我的项目是 react + ts
第一步 npm install --save styled-components
第二步 import styled from 'styled-components';
第三步 因为我的项目是ts 会有语法强校验
好,这一步开始报错
render() {
const Title = styled['h1']`color:red; font-size: 20px`;
return(
<div></div>
);
}

百撕不得其姐
后来换了一种写法 使用中括号的方法 中括号里面传 html
标签
const Title = styled['h1']`color:red; font-size: 20px`;
好了 渲染
网友评论