Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@vman
Created April 26, 2020 14:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vman/e7bad70d054b8533f39e96ef4ed06768 to your computer and use it in GitHub Desktop.
Save vman/e7bad70d054b8533f39e96ef4ed06768 to your computer and use it in GitHub Desktop.
const [styleState, setStyleState] = useState<string>(styles.containerdefault);
//Run anytime the themeState changes.
useEffect(() => {
console.log("themeState useEffect fired");
switch (themeState) {
case "dark":
setStyleState(styles.containerdark);
break;
default:
setStyleState(styles.containerdefault);
}
}, [themeState]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment