ScriptLanes Interview Question

How does useEffect hook work in React?