Skip to content

Commit f20c100

Browse files
committed
refactor(root-theme-hook): add memoization ro root theme hook
1 parent d7b93c3 commit f20c100

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lib/RootTheme/useRootTheme.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {useCallback, useRef} from 'react';
1+
import {useCallback, useMemo, useRef} from 'react';
22
import type {CSSProperties} from 'react';
33
import type {ThemeType} from 'css-vars-hook';
44

@@ -49,7 +49,7 @@ export const useRootTheme = (
4949
themeRef.current = nextTheme;
5050
}, []);
5151

52-
const style = createStyleObject(themeRef.current);
52+
const style = useMemo(() => createStyleObject(themeRef.current), []);
5353

5454
return {
5555
/** Effect to apply new theme to the application */

0 commit comments

Comments
 (0)