ScriptLanes interview question

How does useEffect hook work in React?