Created
March 22, 2023 23:17
-
-
Save ChristianOConnor/c22e36dda9ee79a7728ee531002728ce to your computer and use it in GitHub Desktop.
address collector frontend context/EmailContextManagement.tsx
This file contains hidden or 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 { createContext, useState } from 'react' | |
export const EmailContext = createContext({ | |
email: "none", | |
setEmail: () => {} | |
}) | |
export const EmailContextProvider = (props: any) => { | |
const setEmail = (email: string) => { | |
setState({...state, email: email}) | |
} | |
const initState = { | |
language: "en", | |
setEmail: setEmail | |
} | |
const [state, setState] = useState(initState) | |
return ( | |
<EmailContext.Provider value={state}> | |
{props.children} | |
</EmailContext.Provider> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment