Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: wrapper CacheSwitch with div to avoid error in React v16 - #20

Merged
merged 2 commits into from Jan 25, 2019

Conversation

Ivocin
Copy link
Contributor

@Ivocin Ivocin commented Jan 24, 2019

resolve #19
Because React Components can return array since React v16, to avoid error when using CacheSwitch Component in React v16 - , need to handle the return array.

@Ivocin
Copy link
Contributor Author

Ivocin commented Jan 24, 2019

@CJY0208 any better idea?

@CJY0208
Copy link
Owner

CJY0208 commented Jan 25, 2019

感谢~

目前的担忧是额外的 dom 节点可能会造成未知问题,查询 React 文档后没有找到绕过手段,所以 v15 中确实需要增加这个节点了

但 v16 中可以避免这个问题,所以我认为可以简单地用上一些兼容手段,必要时才添加包裹节点,且优先使用 Fragment 标签

@Ivocin
Copy link
Contributor Author

Ivocin commented Jan 25, 2019

@CJY0208 看看这么改如何
增加了 React 版本判断,主要使用 React 16.0 开始将 React.PropTypes 移除至 prop-types 包
关于 React. Fragment 标签应该是 React 16.2 的新特性

@CJY0208
Copy link
Owner

CJY0208 commented Jan 25, 2019

好的,十分感谢~

@CJY0208 CJY0208 merged commit 03760f6 into CJY0208:master Jan 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CacheSwitch报错
2 participants