React01补充

  • 使用yarn安装脚手架
npm i -g yarn
npm uninstall -g create-react-app
yarn global add create-react-app
create-react-app my-app
  • 有道翻译Api: key
应用ID 36408f4c57bebc38
应用密钥 VIB9yiN5LQZZVkaXOpnKD7DpYMw9VeNl

style样式

  1. 直接写在style属性中

    <button style={{width: 200, height: 200}}>我是按钮</button>
  2. 通关变量声明样式并引用

    const btnStyle = { width: 200, height: 200 };
    ...
    <button style={btnStyle} onClick={this.handleClick}>我是按钮</button>
  3. 通过css样式文件设置

    1. 创建css文件
.btn {
    width: 300px;
    height: 200px;
    background-color: coral;
}

? 2. 引入

import './css/counter.css';

? 3. 使用className

<button className="btn">我是按钮</button>

?

猜你喜欢

转载自www.cnblogs.com/xiaocongcong888/p/9436177.html