| 30 | color?: string |
| 31 | title?: string |
| 32 | }> = props => { |
| 33 | const [theme, setTheme] = createStore({ |
| 34 | color: props.color || defaultState.color, |
| 35 | title: props.title || defaultState.title, |
| 36 | }) |
| 37 | |
| 38 | const changeColor = (color: string) => setTheme('color', color) |
| 39 | const changeTitle = (title: string) => setTheme('title', title) |
| 40 | |
| 41 | return ( |
| 42 | <ThemeContext.Provider value={[theme, {changeColor, changeTitle}]}> |
| 43 | {props.children} |
| 44 | </ThemeContext.Provider> |
| 45 | ) |
| 46 | } |
| 47 | |
| 48 | export const useTheme = () => useContext(ThemeContext) |
| 49 |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…