react lifecycle methods in functional component