Dva: 新创建的App自动使用最新版React.js deprecated的问题

Created on 11 Apr 2017  ·  6Comments  ·  Source: dvajs/dva

目前已知会导致HMR无法使用

Warning: RouterContext: React.createClass is deprecated and will be removed in version 16. Use plain JavaScript classes instead. If you're not yet ready to migrate, create-react-class is available on npm as a drop-in replacement.

目前解决方法是限制react的版本

"react": "15.4.2",
"react-dom": "15.4.2"

Most helpful comment

@pinggod 我觉得dva切到react-router v4才是正道, 继续用3的话一直会落后react-router一个版本 总感觉不讨好

All 6 comments

针对这一问题,react-router 的 issue: https://github.com/ReactTraining/react-router/issues/4932

这里说会更新 [email protected] 版本的相关问题,那么 dva 内部引用的 [email protected] 已经半年多没有更新了,dva 是推动 [email protected] 版本的更新还是有切换到 [email protected] 版本的计划?

@pinggod 我觉得dva切到react-router v4才是正道, 继续用3的话一直会落后react-router一个版本 总感觉不讨好

刚才看了下@pinggod 的连接,看样子这两个都是一个原因了。

Warning: Accessing PropTypes via the main React package is deprecated. Use the prop-types package from npm instead.

Warning: RouterContext: React.createClass is deprecated and will be removed in version 16. Use plain JavaScript classes instead. If you're not yet ready to migrate, create-react-class is available on npm as a drop-in replacement.

@phnessu4 第一个 warning 有可能是其他第三方依赖的问题,比如如果你的项目使用了 antd,那么也会抛出这一个 warning。

@pinggod 不排除antd也有问题,antd还没独立看。刚才找了个dva的demo看了眼,一开始没添加antd的commit就有问题。

+1

Was this page helpful?
0 / 5 - 0 ratings