使用Typescript和ReactJs

时间:2018-02-04 11:49:27

标签: css reactjs typescript button styling

我是新手,想要一些样式控件的例子,例如使用Typescript和ReactJs的按钮

任何帮助表示赞赏

1 个答案:

答案 0 :(得分:1)

你有很多选择。这里有一些:

CSS Classnames

加载css文件,例如

.red {
  color : red;
}

然后使用className道具:https://reactjs.org/docs/dom-elements.html#classname例如

<div className="red">I am red </div>

风格

使用style属性:

<div style={{color: 'red'}}>I am red </div>

在js lib中使用css

有很多选择。我专门为优秀的打字稿支持写了typestyle:https://typestyle.github.io/