@pansy/react-mapbox-gl
Version:
🌍 基于 Mapbox GL 封装的 React 组件库
14 lines (13 loc) • 311 B
JavaScript
// src/hooks/useMap.ts
import { useContext } from "react";
import { MapContext } from "../components/Map/context";
var useMap = () => {
const context = useContext(MapContext);
if (!context) {
throw new Error("The useMap must be used in the Map container");
}
return context;
};
export {
useMap
};