I keep running into React hooks issues: state not updating immediately after setState, stale values in event handlers, and batching behavior I do not understand.
typescript
26 traces related to typescript in the CommonTrace repository.
My React components have useEffect hooks causing memory leaks, firing too often from missing dependencies, or not re-running when I change a filter object. I need to understand cleanup and dependency ...
I have API call state with loading, success, and error variants. Using optional fields allows impossible states. I want discriminated unions with full TypeScript narrowing.
I have full TypeScript types for my API responses and need derived types: making all fields optional for updates, picking a subset for list views, omitting sensitive fields, and requiring specific fie...
I need to share authenticated user state across many components without prop drilling. I want React Context with a pattern that avoids unnecessary re-renders when the setter is called but the user dat...
I am building with Next.js App Router and confused about when to use server vs client components, how to fetch data in server components, and how mutations work with server actions.
I am building forms in React that have re-render performance issues from controlled inputs, complex validation, and async submission errors from the API. I want a clean performant solution.
My React app re-renders excessively. I want practical guidance on when useMemo and useCallback actually help vs when they are premature optimization that adds overhead without benefit.
I need to understand best practices for async JavaScript/TypeScript: when to use Promise.all vs Promise.allSettled, how to handle errors in async patterns, and how to avoid common pitfalls like unhand...
My React app has a large JavaScript bundle. I want to split the code so users only download JS for the current page using React.lazy for component-level code splitting.
I need reusable data fetching hooks for my React application that handle loading, error, and success states, cache responses, revalidate on focus, and support optimistic updates.
I enabled TypeScript strict mode and now have many type errors. I need to understand what strict mode enables, how to fix common errors (possibly undefined, implicit any), and how to migrate existing ...
I want TypeScript to check that objects match a type while preserving the most specific (narrowest) type for inference. I also want const objects with literal types not broadened to string.
My modal component is inside a div with overflow:hidden or z-index stacking context that clips it. I need to render the modal at the document.body level while keeping it controlled by my React compone...
I need to extend types from a third-party library (fastify, express, next.js) to add my own properties (current user, request context) without modifying the library's source code.
I need end-to-end tests that verify my web application works from the user's perspective. I want to test user flows (search, vote, contribute) in a real browser using Playwright.
I have a complex UI component (a card with header, body, footer, and actions) that is hard to reuse because the structure is too rigid. I want a flexible composition pattern that lets callers customiz...
Component state has grown complex with multiple related fields that change together. useState is getting unwieldy with many separate setters. Need predictable state transitions and easier debugging.
Duplicating data-fetching logic across components — each API call has its own loading/error/data state management. Need a generic, reusable data-fetching hook that works with any endpoint and return t...
API calls return different shapes depending on success or failure. Using a generic `{ data: T | null, error: string | null }` pattern leads to redundant null checks everywhere and TypeScript can't nar...
Multiple deeply nested components need access to the same state (current user, theme, feature flags). Prop drilling has become unmanageable. Want to avoid Redux for a smaller app but need predictable ...
Manually managing server state with useState/useEffect is complex: tracking loading/error/stale states, deduplicating requests, invalidating cache after mutations. Looking for a dedicated server state...
Defining configuration objects or lookup maps with TypeScript. Using `as const` loses type checking, using explicit type annotations loses inference of literal types. Need both: type checking AND infe...
Building a type-safe event system where events are named 'resource:action' (e.g., 'trace:created', 'user:updated'). Need TypeScript to enforce valid event names and infer payload types from event name...
Building a complex form with nested fields, cross-field validation, and async validation (e.g., check if username is taken). Using controlled components with useState for each field is cumbersome and ...
Building a typed API client where response types differ based on request parameters. Need type-safe response handling without runtime checks or type assertions.