React question detail
Can you have multiple useEffect hooks in a single component?
Yes, multiple useEffect hooks are allowed and recommended when you want to separate concerns.
useEffect(() => {
// Handles API fetch
}, []);
useEffect(() => {
// Handles event listeners
}, []);
Each effect runs independently and helps make code modular and easier to debug.