2021-02-05 21:32:38 -05:00
|
|
|
import React, { useContext } from "react";
|
2020-05-21 02:46:50 -04:00
|
|
|
|
|
|
|
const MapStageContext = React.createContext({
|
|
|
|
mapStageRef: { current: null },
|
|
|
|
});
|
2021-06-03 01:31:18 -04:00
|
|
|
export const MapStageProvider: any = MapStageContext.Provider;
|
2020-05-21 02:46:50 -04:00
|
|
|
|
2021-02-05 21:32:38 -05: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 02:46:50 -04:00
|
|
|
export default MapStageContext;
|