传入类名以响应组件
2022-08-30 04:32:06
						我正在尝试将类名传递给react组件以更改其样式,并且似乎无法正常工作:
class Pill extends React.Component {
  render() {
    return (
      <button className="pill {this.props.styleName}">{this.props.children}</button>
    );
  }
}
<Pill styleName="skill">Business</Pill>
我正在尝试通过传递具有相应样式的类的名称来更改药丸的样式。我是 React 的新手,所以也许我没有以正确的方式做到这一点。谢谢