StaffCoder
React Native
React NativeReact Native 0.81
12 modules · 47 challengesSign up
Modules12 modules · 47 challenges
The async layer of a React Native app. Requests are debounced so rapid input collapses to one call per pause, superseded requests are cancelled with AbortController, and stale responses are discarded via a monotonic sequence guard in the reducer — never a shallow "latest wins". Independent panels fetch in parallel on mount (no waterfall await) and each holds its own load / success / error state so one failure never blocks the others; retry re-fetches only the failed endpoint. Long-lived polling is a chained setTimeout inside a useEffect — one outstanding request at a time, cleared on unmount — with exponential backoff on consecutive failures up to a ceiling and a reset on success; a banner surfaces after a failure threshold and clears on recovery. Local persistence via AsyncStorage debounces writes and rehydrates on mount BEFORE the network fetch resolves, and a POST submit clears the stored draft only on success. All HTTP is injected via a fetchImpl prop so tests bypass the network entirely.
Finish every challenge, or complete the star challenge, to complete the module.

Challenges

4 challenges

Candidate Skill Search

Sign up to unlock
—No data yetmedium
About this challenge

The talent pool search a recruiter uses to shortlist candidates against a live vacancy. A controlled TextInput debounces requests to /api/candidates?q=, shouldSearch gates against the minimum query length, buildSearchUrl encodes and appends filter params, and each fired request carries a monotonically-increasing seq — searchReducer discards any success or error whose seq is older than the current one (stale-response guard). AbortController cancels the previous in-flight request on every new fire, and filter changes trigger exactly one further request with the current query. Loading / hint / error+retry / loaded (with empty variant) render one at a time.

Solved in a browser IDE and graded by tests. Sign up to solve

Account Overview Panels

Sign up to unlock
—No data yetmedium
About this challenge

The overview screen of a retail banking app that loads several independent panels at once. On mount, App dispatches load for every panel in PANELS and fires fetchImpl for each in parallel — no await between them. Each panel is held in its own panelReducer slot so one failing endpoint renders panel-error-<key> + a retry Pressable while the other two render loaded. Retry re-fetches only that endpoint. The header total is derived on every render via sumAvailable(state) — never mirrored into state — and recomputes as balances resolves. buildEndpointUrl joins base + endpoint without duplicate slashes; the base URL is injected via the apiUrl prop.

Solved in a browser IDE and graded by tests. Sign up to solve

Mortgage Application Progress

Sign up to unlock
—No data yetmedium
About this challenge

The screen an applicant watches while a submitted mortgage application is assessed. On mount StatusScreen fires the initial request and chains subsequent polls via setTimeout — one outstanding request at a time. On success dispatch payload, reset consecutiveFailures to 0, clear the banner, schedule the next poll at baseIntervalMs (or stop when isDecided). On failure increment consecutiveFailures, set the banner at failureThreshold, and schedule the next poll at nextIntervalMs(consecutiveFailures, baseIntervalMs, ceilingIntervalMs) — exponential backoff capped at the ceiling, reset on any success. Unmount clears the scheduled timeout so no further requests fire; pressing Stop polling halts further requests immediately. stageSummary derives the three-stage view (creditCheck / valuation / underwriting) from the payload with 'pending' defaults for missing keys.

Solved in a browser IDE and graded by tests. Sign up to solve

Restaurant Stock Count

STAR
Solving it completes the module
—No data yetmedium
About this challenge

The stocktake screen a restaurant supervisor completes at close. Expected levels load from buildExpectedUrl(siteId); counts typed by the supervisor are written to AsyncStorage under draftKeyFor(siteId, countDate) — debounced so rapid typing collapses to one storage.setItem call per pause — and mergeDraftOverExpected rehydrates the saved draft on mount BEFORE the fetch resolves (restored-draft-notice surfaces only when a draft was found). computeVariance and computeTotals derive per-line variance and the { over, under, missing } totals on every render — never mirrored into state. A storage-area tab bar filters visible lines. Submit POSTs the counts via buildSubmitUrl(siteId); on success calls storage.removeItem(draftKeyFor(...)) and renders submit-success; on failure renders submit-error and keeps the draft on device. Star problem — accumulates the debounce + AbortController + stale-response discipline of 10286, the parallel-independent-state topic of 10287 and the polling-with-backoff topic of 10289, and lands them on offline-durable local persistence + a POST submit.

Solved in a browser IDE and graded by tests. Sign up to solve

We use cookies that are necessary to run Staffcoder, and optional analytics cookies to see which pages get used. Analytics stays off unless you accept. Read our Cookie Policy.