返回 DeepSeek-Reasonix
composeDomRef.ts
根目录 / desktop / frontend / src / lib / composeDomRef.ts
1 import type { RefObject } from "react";
2
3 /** Ref attachment occurs before command publication and is never an async command. */
4 export function composeDomRef<Node>(attach: (node: Node | null) => void, ref: RefObject<Node | null>) {
5 return (node: Node | null) => {
6 attach(node);
7 ref.current = node;
8 };
9 }
10
10 lines TYPESCRIPT