refactor: rewrite collabWrapper to remove TDZs and simplify (#2834)

This commit is contained in:
David Luzar
2021-01-25 10:47:35 +01:00
committed by GitHub
parent 03f6d9c783
commit 0a0be839b9
16 changed files with 312 additions and 264 deletions

View 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;
};