` 标签按钮。
本着测试驱动开发(test-driven development,TDD)的思想,你可以先在discovery.js 工具中定义这个组件的示例用法。
修改前:
```
import Logo from './components/Logo';
{/* ... */}
{/* 可以在这里放置更多的组件示例 */}
```
修改后:
```
import Button from './components/Button';
import Logo from './components/Logo';
{/* ... */}
Buttons
Button with onClick:
A link:
Custom class name:
{/* 可以在这里放置更多的组件示例 */}
```
[或许我们可以把这种方式称为发现驱动开发(discovery-driven development,DDD)?]
注意到上述代码中的() => alert('ouch') 模式了吗?这是ES2015 中箭头函数的一种示例用法。
以下是箭头函数的其他用法。
* () => {} 这是一个空函数,和function() {} 类似。
* (what, not) => console.log(what, not) 这是一个带参数的函数。
* (a, b) => { var c = a + b; return c;} 当函数体中包含多个语句的时候,需要使用花括号{} 包裹。
* let fn = arg => {} 当函数只接收一个参数时,可以省略圆括号()。
# Button.css
根据之前的约定,`