Files
grungnet/src/contexts/MapStageContext.tsx
T

17 lines
434 B
TypeScript
Raw Normal View History

import React, { useContext } from "react";
2020-05-21 16:46:50 +10:00
const MapStageContext = React.createContext({
mapStageRef: { current: null },
});
2021-06-03 15:31:18 +10:00
export const MapStageProvider: any = MapStageContext.Provider;
2020-05-21 16:46:50 +10:00
export function useMapStage() {
const context = useContext(MapStageContext);
if (context === undefined) {
throw new Error("useMapStage must be used within a MapStageProvider");
}
return context;
}
2020-05-21 16:46:50 +10:00
export default MapStageContext;