Stateless Functional Components(3种方式)
class App extends React.Component
function App()
const App= React.createClass
JSX
Component 嵌套
<App>
<MainContent />
</App>
className
class是保留词,需用 className
代替 class
JavaScript 表达式
<h1>{ this.props.children }</h1>
Mapping Arrays to JSX
{ array.map((item, i) => <li key={i}>{item}</li>) }
Spread Attributes
const attrs = {
href: 'http://example.org',
target: '_blank',
};
<a {...attrs}>Hello</a>