Skip to content

Instantly share code, notes, and snippets.

@gladchinda
Last active May 4, 2020 18:39
Show Gist options
  • Save gladchinda/9b366c9ab681ceec81bf93af42cfd5f0 to your computer and use it in GitHub Desktop.
Save gladchinda/9b366c9ab681ceec81bf93af42cfd5f0 to your computer and use it in GitHub Desktop.
import React from 'react';
import useColorScheme from './useColorScheme';
import ThemeContext, { DARK_THEME, LIGHT_THEME } from './theme';
export default function App () {
const dark = useColorScheme('dark');
const theme = dark ? DARK_THEME : LIGHT_THEME;
return <>
<ThemeContext.Provider value={theme}>
{/* Render rest of app (consume the theme context) */}
</ThemeContext.Provider>
</>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment