11. 函数式组件
This commit is contained in:
parent
d8892820e6
commit
a00d0611de
@ -1,4 +1,12 @@
|
|||||||
import React, {useEffect, useState} from "react";
|
import React, {useEffect, useState} from "react";
|
||||||
|
|
||||||
|
|
||||||
|
// 函数式组件
|
||||||
|
// 1. 没有生命周期
|
||||||
|
// 2. 没有 this
|
||||||
|
// 3. 使用各种 Hook 完成操作
|
||||||
|
// 4. 函数式组件本身相当于 render 函数
|
||||||
|
// 5. 函数式组件的第一个参数为 props
|
||||||
export default function SonComponent2(props= {
|
export default function SonComponent2(props= {
|
||||||
msg:"",
|
msg:"",
|
||||||
changeMsg:(_)=>{}
|
changeMsg:(_)=>{}
|
||||||
|
Loading…
Reference in New Issue
Block a user