2017-05-29 32 views
0

對於這樣寫一個簡單的組件:如何在React的功能組件中實現生命週期方法?

import React from 'react' 

const MyComponent = ({text}) => { 
    return(<div> {text} </div> 
} 

是否有實現生命週期方法類似componentDidMount()語法還是我有代碼轉換爲React.Component類?

+0

它必須是一個有權訪問生命週期方法的類 –

回答

相關問題