fix: Provide initial value to useRef in usePrevious hook

TypeScript requires an initial value argument when calling useRef.
Changed useRef<T>() to useRef<T | undefined>(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 <noreply@anthropic.com>
This commit is contained in:
Jan-Henrik Bruhn 2025-12-27 11:59:42 +01:00
parent 757e0cdd73
commit 705815a8fc

View file

@ -15,7 +15,7 @@
import { useEffect, useRef } from "react"; import { useEffect, useRef } from "react";
export function usePrevious<T>(value: T): T | undefined { export function usePrevious<T>(value: T): T | undefined {
const ref = useRef<T>(); const ref = useRef<T | undefined>(undefined);
useEffect(() => { useEffect(() => {
ref.current = value; ref.current = value;