React-hooks的useEffect模擬componentDidUpdate生命週期

先回憶一下:javascript class組件中的componentDidUpdate生命週期是初次渲染完後,當接收的props,state改變時或者this.forceUpdate()就會調用 函數組件中的useEffect能夠看作 componentDidMount,componentDidUpdate 和componentWillUnmount 這三個函數的組合 useEffect( ()
相關文章
相關標籤/搜索