使用StyledComponents将样式赋予React组件

时间:2019-05-21 02:38:04

标签: reactjs styled-components

我有以下包装TeamAbout&PlayerList的组件。我想做的就是将样式应用于TeamAbout。我该如何赋予样式?

import React from "react";
import TeamStage from "../TeamStage";
import TeamAbout from "../TeamAbout";
import PlayerList from "../PlayerList";
import styled from "styled-components";
import { StyleTeamDescription } from "./styles";

const TeamPage = props => {
  return (
    <div>
      <TeamStage
      />
      <StyleTeamDescription>
        <TeamAbout />
        <PlayerList
        />
      </StyleTeamDescription>
    </div>
  );
};

我尝试将组件包装在新的const中,但是未应用样式。

 <StyleTeamDescription>
        <StyleTeamAbout />
        <PlayerList />
 </StyleTeamDescription>

const StyleTeamAbout = styled(TeamAbout)`
  order: 1;
`;

我该怎么办?

0 个答案:

没有答案