Files
grungnet/src/contexts/MapStageContext.js

17 lines
429 B
JavaScript
Raw Normal View History

import React, { useContext } from "react";
2020-05-21 16:46:50 +10:00
const MapStageContext = React.createContext({
mapStageRef: { current: null },
});
export const MapStageProvider = MapStageContext.Provider;
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;