mirror of
https://github.com/duckietm/Nitro-V3.git
synced 2026-06-20 07:26:19 +00:00
React 19: useRef<T>() -> useRef<T>(null) across 15 sites
React 19 dropped the no-arg useRef overload — the type-only useRef<T>() form (no initial value) is gone, every call must pass an initial value. The codebase had 15 occurrences of useRef<HTMLDivElement>() (DOM ref pattern) all flagged by tsgo as 'Expected 1 arguments, but got 0'. Mechanical sweep to useRef<HTMLDivElement>(null) — no behavior change, React still hands out a ref object with .current set to null at mount. Net tsgo error count: 57 -> 42.
This commit is contained in:
@@ -12,7 +12,7 @@ export interface NitroCardViewProps extends DraggableWindowProps, ColumnProps
|
||||
export const NitroCardView: FC<NitroCardViewProps> = props =>
|
||||
{
|
||||
const { theme = 'primary', uniqueKey = null, handleSelector = '.drag-handler', windowPosition = DraggableWindowPosition.CENTER, disableDrag = false, overflow = 'hidden', position = 'relative', gap = 0, classNames = [], isResizable = true, ...rest } = props;
|
||||
const elementRef = useRef<HTMLDivElement>();
|
||||
const elementRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
const getClassNames = useMemo(() =>
|
||||
{
|
||||
|
||||
@@ -30,7 +30,7 @@ export const DraggableWindow: FC<DraggableWindowProps> = props =>
|
||||
const [isDragging, setIsDragging] = useState(false);
|
||||
const [isPositioned, setIsPositioned] = useState(false);
|
||||
const [dragHandler, setDragHandler] = useState<HTMLElement>(null);
|
||||
const elementRef = useRef<HTMLDivElement>();
|
||||
const elementRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
const bringToTop = useCallback(() =>
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@ interface LayoutMiniCameraViewProps {
|
||||
export const LayoutMiniCameraView: FC<LayoutMiniCameraViewProps> = props =>
|
||||
{
|
||||
const { roomId = -1, textureReceiver = null, onClose = null } = props;
|
||||
const elementRef = useRef<HTMLDivElement>();
|
||||
const elementRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
const getCameraBounds = () =>
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@ export const LayoutRoomPreviewerView: FC<{
|
||||
}> = props =>
|
||||
{
|
||||
const { roomPreviewer = null, height = 0 } = props;
|
||||
const elementRef = useRef<HTMLDivElement>();
|
||||
const elementRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
const onClick = (event: MouseEvent<HTMLDivElement>) =>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user