23.
In which situation would you use the empty dependency array in the useEffect() hook?
When you want the effect to run only once, when the component mounts.
When you want the effect to run whenever the component updates.
When you want the effect to run based on a specific condition.
When you want the effect to never run.
Correct: A
When you pass an empty dependency array [] as the second argument to useEffect(), the effect will only run once, when the component mounts. This is useful for fetching data from an API, initializing a library, or subscribing to an event that does not change over time.