refactor(ui): Optimize rendering performance (#8239)

This commit is contained in:
Gal Zahavi
2025-09-17 15:37:13 -07:00
committed by GitHub
parent d54cdd8802
commit 6756a8b8a9
13 changed files with 499 additions and 85 deletions

View File

@@ -15,7 +15,7 @@ export const useStateAndRef = <
>(
initialValue: T,
) => {
const [_, setState] = React.useState<T>(initialValue);
const [state, setState] = React.useState<T>(initialValue);
const ref = React.useRef<T>(initialValue);
const setStateInternal = React.useCallback<typeof setState>(
@@ -32,5 +32,5 @@ export const useStateAndRef = <
[],
);
return [ref, setStateInternal] as const;
return [state, ref, setStateInternal] as const;
};