est*_*Joo 6 javascript ecmascript-6 reactjs es6-class
我见过这样的代码
function abc(){
return 'abc'
}
class MyComponent extends React.Component {
static abc = abc;
render() { return <h1>{this.abc}</h1>; }
}
Run Code Online (Sandbox Code Playgroud)
其中函数abc是在反应类之外定义的。我不知道作者为什么这样做,为什么不能在课堂上这样做?
| 归档时间: |
|
| 查看次数: |
8063 次 |
| 最近记录: |