Open zhouzhongyuan opened 7 years ago
Stateless Functional Component:
function Welcome(props) { return <h1>Hello, {props.name}</h1>; }
ES6 Component:
class Welcome extends React.Component { render() { return <h1>Hello, {this.props.name}</h1>; } }
使用
<Welcome name="Zhongyuan" />
延伸阅读
Advantage
更容易理解(ES5嘛)
代码函数更少
性能更好(假的)
Stateless Functional Component:
ES6 Component:
使用
延伸阅读