create-react-app中为什么使用React.createClass会报warning

create-react-app中使用React-createClas会报如下warning,只能使用extends React.Component.
使用ant design时会报propTypes的warning,报错如下图
求助大神
clipboard.png

阅读 3.2k
2 个回答

react新版将废弃createClass,propType将会分到一个新的模块

新手上路,请多包涵

React.CreatClass将要被废除了,所以不鼓励使用,其实对于简单的展示组件,推荐直接写成函数形式,需要用到生命周期的,用extends React.Component这种形式

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题