Code Explainers
Code explainers tagged #cancellation
javascript
import { useReducer, useEffect } from "react"; const initialState = { status: "idle", data: null, error: null };
Building a data-fetching hook in React
custom-hooks
usereducer
data-fetching
Intermediate
9 steps
python
import asyncio import json from fastapi import APIRouter, Depends, HTTPException
Streaming export progress with SSE in FastAPI
server-sent-events
async-generators
streaming
Advanced
8 steps
javascript
export function createSearchClient(baseUrl) { let inFlight = null; async function search(query, { signal } = {}) {
Cancelling stale requests in a search client
closures
abortcontroller
async
Intermediate
8 steps
typescript
type SearchResult = { id: string; title: string; };
Cancelling stale searches with AbortController
abortcontroller
cancellation
async
Intermediate
7 steps