Replicate lifecycle methods with useEffect()