Hook

若栖1017 / 2023-05-30 / 原文

constructor useState
getDerivedStateFromProps useState 里面 update 函数
shouldComponentUpdate useMemo
render 函数本身
componentDidMount useEffect
componentDidUpdate useEffect
componentWillUnmount useEffect 里面返回的函数
componentDidCatch
getDerivedStateFromError

常用方法:

1.useState

2.useEffect

3.useContext

4.useReducer

5.useCallback

6.useMemo

7.useRef

一。useEffect

它被称为副作用钩子。它可以让你在函数组件中执行副作用操作