Skip to content

Commit 911ba99

Browse files
committed
chore(docs): explain purpose of createContext argument
1 parent c39ce79 commit 911ba99

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

electron/renderer/context/game.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ export interface GameContextValue {
2222
todo?: true;
2323
}
2424

25+
/**
26+
* Defines shape and behavior of the context value
27+
* when no provider is found in the component hierarchy.
28+
*/
2529
export const GameContext = createContext<GameContextValue>({});
2630

2731
GameContext.displayName = 'GameContext';

electron/renderer/context/logger.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ export interface LoggerContextValue {
1616
logger: Logger;
1717
}
1818

19+
/**
20+
* Defines shape and behavior of the context value
21+
* when no provider is found in the component hierarchy.
22+
*/
1923
export const LoggerContext = createContext<LoggerContextValue>({
2024
logger: defaultLogger,
2125
});

electron/renderer/context/theme.tsx

+8-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,14 @@ export interface ThemeContextValue {
1616
setColorMode?: (colorMode: EuiThemeColorMode) => void;
1717
}
1818

19-
export const ThemeContext = createContext<ThemeContextValue>({});
19+
/**
20+
* Defines shape and behavior of the context value
21+
* when no provider is found in the component hierarchy.
22+
*/
23+
export const ThemeContext = createContext<ThemeContextValue>({
24+
colorMode: getThemeName(),
25+
setColorMode: setThemeName,
26+
});
2027

2128
ThemeContext.displayName = 'ThemeContext';
2229

0 commit comments

Comments
 (0)