为了账号安全,请及时绑定邮箱和手机立即绑定

关于新版react组件定义时ImgFigure = React.createClass和class ImgFigure extends React.Component为什么能自动识别?

老版本的react是通过var ImgFigure = React.createClass{}来定义组件,新版本是通过class AppComponent extends React.Component{}来定义组件,但是我试了下,为什么react-webpack里在Maim.js下,利用这两种方式都能正确编译react呢?是通过什么插件的帮助?有没有大神帮忙解惑?万分感谢~~~

正在回答

1 回答

猜测应该是新版本包含了老版本的逻辑属性,所以React.createClass{}仍然可以使用。望采纳

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
React实战--打造画廊应用(上)
  • 参与学习       57339    人
  • 解答问题       273    个

颠覆式前端UI开发框架 React,打造图片画廊实践案讲解

进入课程

关于新版react组件定义时ImgFigure = React.createClass和class ImgFigure extends React.Component为什么能自动识别?

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信