React Interview Question: When Does useEffect Run?
Short answer: useEffect runs after React has committed the render to the screen. With no dependency array it runs after every render; with [] only after mount; with [a, b] after mount and whenever a or b changed. The cleanup runs before the next effect and on...