javascript - HEREMaps 反应无法读取未定义的属性
问题描述
目前正在尝试使用react-here-maps
,但我没有运气使用它。
import React, { Component } from 'react';
import HEREMap from 'react-here-maps';
import PropTypes from 'prop-types';
export default class Map extends Component {
render() {
return (
<HEREMap
appId="KEY"
appCode="KEY"
center={{ lat: 0, lng: 0 }}
zoom={14}
/>
)
}
}
在我的应用程序中使用此组件时,它会给出错误
TypeError: Cannot read property 'object' of undefined
第一个详细的错误行是这个
55 | }
56 | // define the context types that are passed down from a <HEREMap> instance
57 | Circle.contextTypes = {
> 58 | map: React.PropTypes.object
59 | };
60 | Circle.defaultProps = {
61 | fillColor: "rgba(255, 255, 255, 0.5)",
我认为它与proptypes有关,但我已经安装了它。任何人都知道如何解决这个问题?
解决方案
推荐阅读
- php - 如何从商店获取值并插入产品表?
- scala - Neo4j Spark Streaming Scala 的 NotSerializableException
- ilnumerics - Array Visualizer Expression Evaluation 错误:不支持的调试会话类型
- django - 由于 AppRegistryNotReady,Django 2.0 单元测试未运行
- java - 使用霍夫圆变换检测外圆
- angular - 使用 angular5 和 ng-bootstrap 创建拖放排序列表
- python - python用“”替换第一个字符
- python - 将 XML 转换为 CSV 时仅使用属性的一部分
- arrays - 在每个点处拆分字符串,除非出现某些单词
- ansible - 如何以模块化方式使用模板/blockinfile/lineinfile 构建配置