React useTimeout Hook: Declarative setTimeout with Cleanup (2026)Here is a "Copied!" button. Every codebase has one, and this version has three bugs: function CopyButton({ text }: { text: string }) { const [copied, setCopied] = useState(false); useEffect(() =>Aug 21 · 12 min readreactuse.hashnode.dev
React useEventListener Hook: Type-Safe DOM Events (2026)Here's a modal close-on-Escape that quietly does the wrong thing: function Modal({ onClose }: { onClose: () => void }) { useEffect(() => { const onKey = (e: KeyboardEvent) => { if (e.key =Aug 20 · 12 min readreactuse.hashnode.dev
React useScrollLock Hook: Lock Body Scroll for Modals (2026)Your modal is open, centered, perfect. Then someone flicks the overlay and the page behind it scrolls away underneath. Everyone's first fix is the same three lines: useEffect(() => { document.body.sAug 19 · 13 min readreactuse.hashnode.dev
React scrollIntoView with useRef: Scroll to an Element (2026)You have a long form. The user hits Submit, validation fails on a field three screens down, and the error message renders somewhere they can't see. The fix is one browser API call — but where you put Aug 18 · 13 min readreactuse.hashnode.dev
React useSessionStorage Hook: Per-Tab State That Survives Reloads (2026)React useSessionStorage Hook: Per-Tab State That Survives Reloads (2026) Here's a checkout flow that loses the customer at step three: function Checkout() { const [step, setStep] = useState(0); coAug 17 · 13 min readreactuse.hashnode.dev