Created
September 28, 2021 20:41
-
-
Save colinfwren/a0203979d54efa3771a38fefba32be24 to your computer and use it in GitHub Desktop.
ViewBox Context
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 } from 'react'; | |
const ViewBoxContext = createContext({ | |
xPos: 75, | |
setXPos: () => null, | |
yPos: 75, | |
setYPos: () => null, | |
scale: 1, | |
setScale: () => null, | |
scaleDelta: 0, | |
setScaleDelta: () => null, | |
miniMapX: 75, | |
setMiniMapX: () => null, | |
miniMapY: 75, | |
setMiniMapY: () => null, | |
}); | |
const { Provider } = ViewBoxContext; | |
export function ViewBoxProvider({ children, value}) { | |
return <Provider value={value}>{children}</Provider> | |
} | |
export const ViewBoxConsumer = ViewBoxContext.Consumer; | |
export default ViewBoxContext; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment