码迷,mamicode.com
首页 > 其他好文 > 详细

[React] Define defaultProps and PropTypes as static methods in class component

时间:2017-10-05 20:01:10      阅读:203      评论:0      收藏:0      [点我收藏+]

标签:eof   false   ops   com   logs   component   eth   and   type   

class Toggle extends Component {
  static propTypes = {
    defaultOn: PropTypes.bool,
    on: PropTypes.bool,
    onToggle: PropTypes.func,
    children: PropTypes.oneOfType([
      PropTypes.func,
      PropTypes.array
    ]).isRequired,
  }
  static defaultProps = {
    defaultOn: false,
    onToggle: () => {},
  }
}

 

[React] Define defaultProps and PropTypes as static methods in class component

标签:eof   false   ops   com   logs   component   eth   and   type   

原文地址:http://www.cnblogs.com/Answer1215/p/7629853.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!