-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add temp manifestocontext to avoid having to sign all the time
- Loading branch information
Showing
3 changed files
with
64 additions
and
28 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import React, { useContext, useMemo, useState } from "react"; | ||
|
||
interface ManifestoContextValue { | ||
hasSignedManifesto: boolean; | ||
setHasSignedManifesto: (hasSigned: boolean) => void; | ||
} | ||
|
||
const ManifestoContext = React.createContext<ManifestoContextValue>({ | ||
hasSignedManifesto: false, | ||
setHasSignedManifesto: () => {}, | ||
}); | ||
|
||
export const ManifestoContextProvider = ({ | ||
children, | ||
}: React.PropsWithChildren) => { | ||
const [hasSignedManifesto, setHasSignedManifesto] = useState(false); | ||
|
||
const value = useMemo(() => { | ||
return { | ||
hasSignedManifesto, | ||
setHasSignedManifesto: () => setHasSignedManifesto(true), | ||
}; | ||
}, [hasSignedManifesto, setHasSignedManifesto]); | ||
|
||
return ( | ||
<ManifestoContext.Provider value={value}> | ||
{children} | ||
</ManifestoContext.Provider> | ||
); | ||
}; | ||
|
||
export const useManifestoContext = () => useContext(ManifestoContext); |
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