import { useCallback, useState } from "react"; export const useCallbackRefState = () => { const [refValue, setRefValue] = useState(null); const refCallback = useCallback((value: T | null) => setRefValue(value), []); return [refValue, refCallback] as const; };