类组件和函数组件

import React,{Component} from "react"; 

// export default class App extends Component{  
//     constructor(){
//       super();
//       this.state = {
//         message:'你好啊'
//       }
//     }
//     render(){
//       return (
//         <div>
//           App组件---  {this.state.message}
//         </div>
//       );
//     }  
// }
 

/**
 *  函数组件 
 *  1 没有 this 对象
 *  2 没有内部的状态
*/
export default function App(){
  return (
    <div>function 组件</div>
  )
}
posted @ 2021-08-10 17:53  13522679763-任国强  阅读(40)  评论(0)    收藏  举报