function MyComponent() {
return (
<React.Fragment>
Some text.
<h2>A heading</h2>
More text.
<h2>Another heading</h2>
Even more text.
</React.Fragment>
)
}
html中调用方法
<div>{
MyComponent()
}</div>
function MyComponent() {
return (
<React.Fragment>
Some text.
<h2>A heading</h2>
More text.
<h2>Another heading</h2>
Even more text.
</React.Fragment>
)
}
html中调用方法
<div>{
MyComponent()
}</div>