How to replicate a React component lifecycle with useEffect | Hacker News Reader