[React] Extend styles with styled-components in React

Posted answer1215

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[React] Extend styles with styled-components in React相关的知识,希望对你有一定的参考价值。

In this lesson, you will learn how to extend styles from one styled-component to another in a React app. This is helpful when you have two styled-components that are similar but differ in one or more CSs properties.

 

import styled from ‘styled-components‘;

export const Button = styled.button`
  background-color: #FF851B;
  border-radius: 5px;
  color: white;
  display: block;
  font-weight: bold;
  font-size: 22px;
  padding: 16px 32px;
  text-transform: uppercase;
  margin: 100px auto;
`;

export const HelpButton = styled(Button)`
  background-color: #FF4136;
  margin: 15px;
  position: fixed;
  bottom: 0;
  right: 0;
`;

 

以上是关于[React] Extend styles with styled-components in React的主要内容,如果未能解决你的问题,请参考以下文章

React Native和JSON文件解析

反应故事书复选框更改处理程序不起作用

jQuery $.extend()用法总结

create-react-app — 如何将 EXTEND_ESLINT 设置为 true?

在 React 中使用 Cloudinary 小部件

React——嵌入已有项目 && jsx