Maze interview question

How does useEffect hook work