UNPKG

@uiw/react-amap-map

Version:

基于 React 封装的高德地图组件。AMap Component Based On React.

24 lines 603 B
import _extends from "@babel/runtime/helpers/extends"; import React from 'react'; import { useContext } from 'react'; export var initialState = { map: undefined, AMap: undefined, container: undefined }; export var reducer = (state, action) => { return _extends({}, state, action); }; export var Context = /*#__PURE__*/React.createContext({ state: initialState, dispatch: () => null }); export function useMapContext() { var _useContext = useContext(Context), state = _useContext.state, dispatch = _useContext.dispatch; return _extends({}, state, { state, dispatch }); }