Fetch Data in an Effect

Talk it through with a coach who asks guiding questions and gives hints until you reach the answer. Pass to mark the challenge as completed.

The problem

  • medium
  • Pro

A profile page fetches a user in an effect whenever the user ID prop changes. When you click quickly between profiles, sometimes the wrong user's data appears. Explain why, how you'd fix it, and when you'd reach for a data-fetching library instead.

Talk this problem through with an AI coach

This is a Pro challenge. Sign in with Google, then upgrade to start a voice session.

Start free →