← All tags

#react

10 entries tagged #react

  • Building a Typed Fetch Factory

    Post · Aug 25, 2026

    How a single createFetcher factory infers request/response types from an OpenAPI schema and layers in caching, retries, and cancellation, and why each piece is built the way it is.

  • useLocalStorage

    Snippet · Sep 1, 2026

    A `localStorage`-backed `useState` built on `useSyncExternalStore`: no hydration mismatch under SSR, live updates when another tab writes, and live updates when another hook on the same page writes.

  • useControllableState

    Snippet · Sep 1, 2026

    One hook that lets a component be driven from outside (`value` + `onChange`) or manage its own state (`defaultValue`), the same two-mode contract a native `<input>` has, while the component body only ever reads one value and calls one setter.

  • A Readable useToggle

    Snippet · Sep 1, 2026

    A boolean `useState` that hands back `on` / `off` / `toggle` instead of a raw setter, so call sites read as intent. Every function, and the controls object itself, stays referentially stable, safe to pass as props or list as effect dependencies without retriggering anything downstream.

  • Typed Fetch Factory

    Snippet · Aug 25, 2026

    A reusable fetch factory that infers request/response types from an OpenAPI schema and adds in-memory caching, retry with backoff, and AbortController support, no per-endpoint boilerplate, no `any`.

  • Pick a Rendering Strategy for a Next.js Route

    Cheatsheet · Sep 1, 2026

    An App Router route is prerendered by default and silently turns dynamic the moment you read something request-specific. Knowing which bucket a route belongs in (and what forces it out) is the difference between an instant page and a server render on every hit.

  • itsnas.me (external site)

    Project · Jan 12, 2025