mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
refactor: rewrite collabWrapper to remove TDZs and simplify (#2834)
This commit is contained in:
parent
03f6d9c783
commit
0a0be839b9
16 changed files with 312 additions and 264 deletions
7
src/hooks/useCallbackRefState.ts
Normal file
7
src/hooks/useCallbackRefState.ts
Normal file
|
@ -0,0 +1,7 @@
|
|||
import { useCallback, useState } from "react";
|
||||
|
||||
export const useCallbackRefState = <T>() => {
|
||||
const [refValue, setRefValue] = useState<T | null>(null);
|
||||
const refCallback = useCallback((value: T | null) => setRefValue(value), []);
|
||||
return [refValue, refCallback] as const;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue