Last active
May 23, 2020 12:21
-
-
Save vman/2045b9878934274ecfab765310f710f0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const [themeState, setThemeState] = useState<string>(props.teamsTheme || "default"); | |
//Run effect once when the component loads. We will use this effect to register our Theme Changed handler. | |
useEffect(() => { | |
console.log("registerOnThemeChangeHandler useEffect fired"); | |
props.context.sdks.microsoftTeams.teamsJs.registerOnThemeChangeHandler((theme: string) => { | |
console.log(`theme changed to: ${theme}`); | |
//Update the themeState with the new theme. | |
setThemeState(theme); | |
}); | |
}, []); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment