在 <React.StrictMode> 下,组件实例无法正确销毁或者运行报错
- Dominant language
- JavaScript
- Stars
- 1k
- Forks
- 148
- PR merge metrics
- No merged PRs in 30d
Description
+ [x] 我已经搜索过 issue,没有类似的问题,或者类似的问题仍然没有解决方案。
+ [x] 我已经搜索过[文档](https://elemefe.github.io/react-amap/articles/start),并且仍然没有找到解决方案。
+ [x] 我写了个问题重现的例子,链接或者代码将会贴在下面。
#### Reproduce Example Link or Code Fragment
以下是依赖版本

以下是我react代码,我在开发环境启用了 [React.StrictMode] 严格模式.

由于在 [开发环境] && [严格模式] 下react生命周期会重复调用,所以会导致AMap组件BUG.
例如: marker重复出现, polyline无法销毁等等
#### What is Expected?
希望修复对 [React.StrictMode] 严格模式下的支持. 迎接react17 Async Rendering的到来
#### What is actually happening?
组件更新状态后,无法销毁原来的实例.
例如:
* 新marker渲染出来后,旧marker没有销毁
* 新polyline渲染出来后,旧polyline没有销毁

初步结论是,[严格模式](https://react.docschina.org/docs/strict-mode.html#%E4%B8%A5%E6%A0%BC%E6%A8%A1%E5%BC%8F)下,react生命周会重复调用,副作用函数产生bug.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.