Implement abortable retry with exponential backoff
React + TypeScript Interview Core · Money + Async Utilities
Write a typed helper that handles cancellation, retryable errors, jitter, and cleanup on unmount.
Prompt
Implement abortable retry with exponential backoff
This is a hands-on rep. Attempt the drill before reading the model answer, then narrate the tradeoffs as if an interviewer is watching.
Use it for polling a transfer detail endpoint or refreshing quote data.
What to ground before answering
Write a typed helper that handles cancellation, retryable errors, jitter, and cleanup on unmount.
Focus vocabulary: async, retry, AbortController.
The useful mental model is not to memorize a perfect answer. It is to explain what owns the data, what can fail, what the user sees, and what test would prove the behavior.
Calculate bounded retry backoff
Make the behavior executable before comparing against the model answer.
function nextRetryDelay(attempt: number, baseMs: number, maxMs: number): number {
// TODO: exponential backoff capped at maxMs. attempt starts at 0.
return baseMs;
}Interview explanation prompt
- What problem is this practice item really testing?
- What state or contract boundary must be explicit?
- What edge case would cause a production regression?
- What would you test first?
- How would you explain the tradeoff in two minutes?
Self-grade
- Strong answer handles the edge cases before polishing syntax.
- Strong answer explains why the chosen type or function boundary prevents bugs.
- Weak answer passes only the happy path or hides uncertainty in booleans and nullable fields.
Model Answer
function nextRetryDelay(attempt: number, baseMs: number, maxMs: number): number {
const safeAttempt = Math.max(0, attempt);
return Math.min(maxMs, baseMs * 2 ** safeAttempt);
}Recall before moving on
- What is the one-sentence answer for "Implement abortable retry with exponential backoff"?
- Which real experience from PR TIMES, React/TypeScript migration, or systems work supports it?
- What edge case would you volunteer before the interviewer asks?
- What is the smallest test or artifact that proves the design works?