A. Effect will run only once and log initial count, ignoring updates.
B. Effect will never run because dependency array is empty.
C. Effect will run on every render causing infinite loop.
D. Syntax error due to missing dependencies.
Solution
Step 1: Check dependency array usage
Empty array means effect runs once after first render only.
Step 2: Understand effect behavior with state
Effect logs count only once with initial value, ignoring later count changes.
Final Answer:
Effect will run only once and log initial count, ignoring updates. -> Option A
Quick Check:
Empty array ignores state changes [OK]
Hint: Empty array ignores state changes inside effect [OK]
Common Mistakes:
Thinking effect runs on every count change
Assuming empty array stops effect from running
Confusing syntax error with logical error
5. You have a useEffect that depends on two props: userId and filter. Which dependency array is correct to ensure the effect runs only when these props change?