React tips
2 tips · newest first
React 19 tips: the compiler, new hooks like useActionState and useOptimistic, and patterns that replace boilerplate — each as a minimal snippet.
The stale closure, your debounced callback saves old state
REACTStabilizing a debounce with useMemo(() => debounce(fn, 300), []) fixes one bug and creates a worse one: the callback is…
react19debounce
@DevDhaifHandle form mutations with built-in pending and error state via useActionState
REACTuseActionState wraps an async action and returns the last result, the action to bind to a <form action>, and a pending…
react19forms
@hnooz