What is the primary role of the useEffect hook in data fetching within React?
A
It directly updates the component’s state.
B
It renders components conditionally.
C
It manages side effects, such as fetching data, outside the normal render process.
D
It handles form validation logic.
When using useEffect for data fetching, which dependency array configuration ensures that the fetch operation runs only once when the component mounts?
A
[]
B
[state]
C
[state, props]
D
No dependency array
How can race conditions in data fetching be prevented in React?
A
By returning a cleanup function to cancel ongoing requests.