美文网首页
Accessing PropTypes via the main

Accessing PropTypes via the main

作者: 郭玉民 | 来源:发表于2017-06-12 10:40 被阅读0次

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

2.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.

“import { Button } from 'antd';”这个语法导致的1和2的问题是吗

你这个只是warning,并不影响开发的,其实你不用管的。

至于出现warning的原因,里面已经说的很清楚了:

PropTypes已经不建议直接从react中获取了,而是从prop-types组件中获取

createClass也会在react 16中去除,所以不建议使用。

可能是因为你引入的某些组件还在使用这些东西吧,不过只是warning并不影响开发的。

相关文章

网友评论

      本文标题:Accessing PropTypes via the main

      本文链接:https://www.haomeiwen.com/subject/icqlqxtx.html