Skip to content

Commit 08c3850

Browse files
committed
provide default value for theme context
1 parent b50b9a8 commit 08c3850

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

reflex/.templates/web/utils/react-theme.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ import {
1010

1111
import { isDevMode, defaultColorMode } from "$/utils/context";
1212

13-
const ThemeContext = createContext();
13+
const ThemeContext = createContext({
14+
theme: defaultTheme,
15+
resolvedTheme: defaultTheme !== "system" ? defaultColorMode : "light",
16+
setTheme: () => {},
17+
});
1418

1519
export function ThemeProvider({ children, defaultTheme = "system" }) {
1620
const [theme, setTheme] = useState(defaultTheme);

0 commit comments

Comments
 (0)