Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save full-stack-concepts/10ad9cd1569570493b41299ad3132a12 to your computer and use it in GitHub Desktop.
Save full-stack-concepts/10ad9cd1569570493b41299ad3132a12 to your computer and use it in GitHub Desktop.
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