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(() =>12 min read·reactuse.hashnode.devAug 21
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 =12 min read·reactuse.hashnode.devAug 20
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.s13 min read·reactuse.hashnode.devAug 19
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 put13 min read·reactuse.hashnode.devAug 18
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); co13 min read·reactuse.hashnode.devAug 17