Data & APIs

Data fetching patterns

Data fetching should match the source and freshness requirements. Static data can be generated ahead of time; dynamic data may require request-time work.

  • Define loading and error states.
  • Validate external data rather than trusting its shape.
  • Keep secrets server-side.
  • Cache intentionally instead of assuming every request should be cached.
Lesson complete?Use the next lesson to continue the learning path.