You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
424 B

2 years ago
  1. // 类组件的创建和渲染
  2. // 导入 React 包
  3. import React from 'react'
  4. // 创建
  5. class HelloComponent extends React.Component {
  6. render() {
  7. return <div>this is class Component</div>
  8. }
  9. }
  10. function App() {
  11. return (
  12. <div>
  13. {/* 渲染类组件 */}
  14. {/* 第一种: */}
  15. <HelloComponent />
  16. {/* 第二种 */}
  17. <HelloComponent></HelloComponent>
  18. </div>
  19. )
  20. }
  21. export default App