React.PropTypes.number控制台报错说number是undefined
来源:互联网 发布:苹果手机日志软件 编辑:程序博客网 时间:2024/05/16 18:59
组件里
BodyIndex.propTypes = {
usernum: React.PropTypes.number
};
控制台报错显示的是:Cannot read property 'number' of undefined
在之前的版本之中,我们可以通过React.PropTypes这个API访问React内置的一些类型来检查props,在15.5.0版本中,这一API被独立成了一个新的包 prop-types
// 15.4 以前import React from 'react';class Component extends React.Component { render() { return <div>{this.props.text}</div>; }} Component.propTypes = { text: React.PropTypes.string.isRequired,}// 15.5 以后import React from 'react';import PropTypes from 'prop-types';class Component extends React.Component { render() { return <div>{this.props.text}</div>; }}Component.propTypes = { text: PropTypes.string.isRequired,};
阅读全文
0 0
- React.PropTypes.number控制台报错说number是undefined
- import {PropTypes} from 'react'; PropTypes is undefined
- React中的PropTypes是啥意思哇
- react PropTypes
- React.PropTypes
- React.createElement: type should not be null, undefined, boolean, or number
- React之PropTypes
- React 的PropTypes
- react教程之PropTypes
- React的PropTypes 验证
- React之PropTypes属性
- react-native PropTypes
- react-native-baidu-map undefined is not an object(evaluting 'a.PropTypes.bool')
- Number
- number
- number
- Number
- number
- 重识java5
- vs 批处理指定文件夹中的图片
- 001: MatchNet: Unifying Feature and Metric Learning for Patch-Based Matching
- 软件项目管理流程总结
- Coursera | Andrew Ng (01-week-2-2.2)—Logistic 回归
- React.PropTypes.number控制台报错说number是undefined
- MATLAB实现一个简单的车牌识别小程序
- 英语导师思考总结
- C++内联
- Spring Boot初识
- 【BZOJ1857】传送带(三分)
- 统计学---极端异常值的检测
- Blog的API(php裸写
- (lintcode)第31题,数组划分