Created
July 1, 2019 12:04
-
-
Save Gerhut/20447465d9a693559c688b55ac84618c 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
import React, { | |
createContext, | |
useState, | |
useContext | |
} from 'react' | |
const AppContext = createContext({ | |
checking: true, | |
setChecking (checking) {} | |
}) | |
export function AppProvider ({ children }) { | |
const [checking, setChecking] = useState(true) | |
const value = { checking, setChecking } | |
return ( | |
<AppContext.Provider | |
value={value} | |
children={children} | |
/> | |
) | |
} | |
export default function useApp () { | |
return useContext(AppContext) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment