Accessing PropTypes via the main React package is deprecated

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并不影响开发的。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • React Native Controllers Important: Please review the fol...
    taiji1985阅读 1,941评论 0 1
  • Correctness AdapterViewChildren Summary: AdapterViews can...
    MarcusMa阅读 8,947评论 0 6
  • #一练每日晨问#6月第1周 发现 生命就是一场发现的游戏。学习是一个发现的过程。你只能看见你想看见的,你也只能听到...
    Archer莫阅读 196评论 0 0
  • 茫茫人海,漫漫征途,我从来都是默默提醒自己,保持着一颗谦卑的心,不敢有丝毫僭越! 因为,世界太大,路还漫长!
    粉条好吃不啦阅读 309评论 0 1
  • 橙黄色的外皮,形如一个略被挤压过的小皮球。上头出一支梗,携几片叶,梗边的皮儿稍有皱褶,兴许是想冒名顶替中国的...
    April2005阅读 362评论 0 0