作者:陈俊凯660638 | 来源:互联网 | 2022-12-02 00:31
使用React组件对普通HTML元素进行样式设置的基本用法react-emotion
如下:
import React from 'react';
import styled from 'react-emotion';
const StyledCOntainer= styled.div`
display: block;
box-sizing: border-box;
`;
给定的代码将给我们这样的东西:
无论如何,我可以id
向生成的HTML元素添加装饰物吗?提前致谢。
1> Gabriele Pet..:
id
使用此组件时只需添加属性。
import React from 'react';
import styled from 'react-emotion';
const StyledCOntainer= styled.div`
display: block;
box-sizing: border-box;
`;
// and when you want to use this component add id attribute
我不敢相信我从未想过。它是如此简单和基本。大声笑。无论如何,谢谢!