首页 > 其他 > 详细

报错 _react3.default.createClass is not a function

时间:2018-04-16 23:04:38      阅读:1206      评论:0      收藏:0      [点我收藏+]

这个是因为react最新版本抛弃使用了createClass这个函数,这个也是为了配合ES6 。这种情况下会报错

var Popover = React.createClass({
  propTypes: {
  isVisible: PropTypes.bool,
  onClose: PropTypes.func,
  },
 

.........

........

........

应修改为下面的写法:

export default class Popover extends React.Component{

getInitialState() {
return {
contentSize: {},
anchorPoint: {},
popoverOrigin: {},
placement: ‘auto‘,
isTransitioning: false,
defaultAnimatedValues: {
scale: new Animated.Value(0),
translate: new Animated.ValueXY(),
fade: new Animated.Value(0),
},
};
}

 

报错 _react3.default.createClass is not a function

原文:https://www.cnblogs.com/cui-cui/p/8859113.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!