标签:dom,text,react,MyComponent,方法,heading From: https://www.cnblogs.com/ranyonsue/p/16791367.htmlfunction 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>