UNPKG

@uiw/react-baidu-map-map

Version:
36 lines (35 loc) 841 B
"use strict"; var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default; Object.defineProperty(exports, "__esModule", { value: true }); exports.reducer = exports.initialState = exports.Context = void 0; exports.useMapContext = useMapContext; var _react = _interopRequireWildcard(require("react")); const initialState = exports.initialState = { map: undefined, BMap: undefined, container: undefined }; const reducer = (state, action) => { return { ...state, ...action }; }; exports.reducer = reducer; const Context = exports.Context = /*#__PURE__*/_react.default.createContext({ state: initialState, dispatch: () => null }); function useMapContext() { const { state, dispatch } = (0, _react.useContext)(Context); return { ...state, state, dispatch }; }