From 705815a8fcdb1679a54adfe9f76e098f6b4e31d0 Mon Sep 17 00:00:00 2001 From: Jan-Henrik Bruhn Date: Sat, 27 Dec 2025 11:59:42 +0100 Subject: [PATCH] fix: Provide initial value to useRef in usePrevious hook MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TypeScript requires an initial value argument when calling useRef. Changed useRef() to useRef(undefined) to fix build error and properly type the ref for the first render. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- src/hooks/usePrevious.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hooks/usePrevious.ts b/src/hooks/usePrevious.ts index 26b8021..f081f95 100644 --- a/src/hooks/usePrevious.ts +++ b/src/hooks/usePrevious.ts @@ -15,7 +15,7 @@ import { useEffect, useRef } from "react"; export function usePrevious(value: T): T | undefined { - const ref = useRef(); + const ref = useRef(undefined); useEffect(() => { ref.current = value;