Created
May 5, 2021 20:08
-
-
Save imaginamundo/96cb2a2bf08967cef636b0a0c5f4b68a 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, useContext, useState } from "react"; | |
const Context = createContext({}); | |
export function AuthContextProvider({ children }) { | |
const [ auth, setAuth ] = useState(null); | |
return ( | |
<Context.Provider value={ { auth, setAuth } }> | |
{ children } | |
</Context.Provider> | |
); | |
} | |
export default function useAuthContext() { | |
return useContext(Context); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment