← Coinbase Interview InsightsFrontend Engineer

Coinbase·Frontend Engineer·Take-home Assignment·Senior

Senior
May 2026

Summary

Coinbase frontend take-home where you build a list component that fetches from an API. Sounds straightforward but the race condition and cleanup requirements are where they're really testing you.

Questions Asked (2)

Q1

Build a reusable list UI component in a frontend framework of your choice that fetches its data from an HTTP API on mount, supports manual refresh, and handles loading and error states.

API & IntegrationsTechnical Trade-offs
Author's notes

The basic rendering part took maybe 30 minutes.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and choosing a framework (e.g., React) that aligns with the company's stack. Then outline the component's architecture, focusing on state management for data, loading, and error states, and demonstrate how to fetch data on mount and on manual refresh. Emphasize reusability through props and separation of concerns, and discuss trade-offs like error handling strategies and performance optimizations.

Pro tip: Mention that you'd extract the data fetching logic into a custom hook (e.g., useFetch) to promote reusability and testability, and discuss how you'd handle race conditions and caching to avoid unnecessary network requests.

1. Clarify Requirements and Choose Framework

Ask clarifying questions about the expected data shape, pagination, and error handling. Choose a framework like React, Vue, or Angular based on the company's tech stack and your familiarity.

2. Design Component API and State

Define props for reusability (e.g., endpoint, renderItem, onError). Plan state for data, loading, error, and possibly a refresh trigger. Use hooks or equivalent for state management.

3. Implement Data Fetching Logic

Use useEffect (or equivalent) to fetch data on mount and when refresh is triggered. Handle loading and error states, and ensure cleanup to prevent memory leaks or race conditions.

4. Render UI with Loading and Error States

Conditionally render a loading indicator, error message with retry option, or the list of items. Ensure the UI is accessible and provides feedback to the user.

5. Discuss Trade-offs and Optimizations

Talk about trade-offs such as using a library like React Query vs. custom hook, caching strategies, and how to handle race conditions. Mention testing and edge cases.

Key Points to Mention

  • Separation of concerns: extract data fetching into a custom hook for reusability and testability.
  • Handling race conditions: use AbortController or a flag to ignore stale responses.
  • Error handling: provide user-friendly error messages and a retry mechanism.
  • Loading states: show skeleton loaders or spinners to improve perceived performance.
  • Reusability: design props to allow customization (e.g., renderItem, endpoint, headers).
  • Performance: consider memoization, virtualization for long lists, and caching strategies.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

How do you handle race conditions from overlapping fetch requests, and ensure a component unmounting mid-request doesn't cause stale state updates?

API & IntegrationsTechnical Trade-offsSystem Design
Author's notes

This is the real question hiding inside the prompt.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by acknowledging that race conditions and stale updates are common in async UI, then present a layered solution: cancellation (AbortController), request sequencing (ignore stale responses), and cleanup on unmount. Emphasize that the best approach depends on the framework and whether you need to cancel the request or just ignore the result.

Pro tip: Mention that AbortController is not just for fetch—it can be passed to any async operation that supports cancellation, and always pair it with a cleanup function in useEffect to avoid memory leaks. Also, note that ignoring stale responses is often sufficient and simpler than full cancellation, especially when the request is cheap or already in flight.

1. Identify the race condition

Explain that overlapping requests can resolve out of order, causing the UI to show data from an older request. Also, unmounting mid-request can lead to setState on an unmounted component, causing warnings or memory leaks.

2. Use AbortController for cancellation

Create an AbortController per request, pass its signal to fetch, and call abort() in the cleanup function of useEffect. This cancels the request when the component unmounts or when a new request supersedes the old one.

3. Implement request sequencing or ignore stale responses

Track the latest request ID or timestamp and only update state if the response corresponds to the most recent request. This handles cases where cancellation isn't possible or the request completes before abort.

4. Cleanup on unmount

In useEffect, return a cleanup function that aborts any pending request and sets a flag (e.g., isMounted) to prevent state updates after unmount. Alternatively, use a ref to track mounted status.

5. Consider trade-offs and alternatives

Discuss when to use cancellation vs. ignoring stale responses, and mention libraries like React Query or SWR that handle these patterns out of the box. Also, note that in React 18+, the 'setState on unmounted component' warning was removed, but the underlying issue of stale updates remains.

Key Points to Mention

  • AbortController and its signal property for cancelling fetch requests
  • Request sequencing (e.g., using a ref to store the latest request ID) to ignore out-of-order responses
  • Cleanup function in useEffect to abort requests and prevent state updates after unmount
  • The difference between cancelling a request and ignoring its result, and when each is appropriate
  • React Query/SWR as abstractions that handle race conditions and caching automatically
  • Potential memory leaks and performance implications of not handling these issues

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.