Created
March 7, 2022 09:14
-
-
Save full-stack-concepts/10ad9cd1569570493b41299ad3132a12 to your computer and use it in GitHub Desktop.
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 FormContext = createContext(); | |
export const FormContextProvider = ({children}) => { | |
const [email, setEmail] = useState(); | |
const [password, setPassword] = useState(); | |
const [step1, setStep1Finished ] = useState(false); | |
const [finished, setFinished] = useState(false); | |
const formContextValues = { | |
email, setEmail, | |
password, setPassword, | |
step1, setStep1Finished, | |
finished, setFinished | |
}; | |
return (<div> | |
<FormContext.Provider value={formContextValues}> | |
{children} | |
</FormContext.Provider> | |
</div>); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment