javascript - 无法在 React 中使用 MapControl 删除 react-leaflet Map
问题描述
我使用 MapControl 在 Leaflet 地图中创建了地图图例。一切正常,但是当我尝试删除 Map 组件时,我Uncaught TypeError: Cannot read property 'remove' of undefined
从MapControl.js
. 有谁知道如何解决它?
下面是代码框中的示例 - 5 秒后,我删除了地图并更改了内容。 https://codesandbox.io/s/how-to-add-a-legend-to-the-map-using-react-leaflet-forked-if0q4?file=/src/Map.js
解决方案
推荐阅读
- laravel - 从laravel中的关系模型获取数据时如何分页和排序
- python - 无论我发送 1 还是 0 的数组,Python matplotlib imshow 总是给我白色
- javascript - 打开引导模式单击自动生成的元素
- puppet - 在 Yaml 中使用来自 hiera 哈希的值
- python - 放大极坐标图
- javascript - 如何获取动态生成的表 td 输入值
- php - 部分获取有序行
- javascript - Chrome 控制台的执行方式是否与 Visual Studio Code 相同?
- python - Django TypeError:int() 参数必须不是“设置”
- c - 将结构转换为成员类型的指针