React card reviewmedium
What is the purpose of the dependency array in useEffect?
The dependency array controls when a useEffect hook executes. If no dependency array is provided, the effect runs after every render. If an empty array is provided, the effect runs only once when the component mounts. If specific dependencies are included, the effect re-runs whenever one of those values changes. Proper use of dependencies helps prevent unnecessary executions and improves performance.