【Typechecking With PropTypes】
1、props类型检查
React has some built-in typechecking abilities. To run typechecking on the props for a component, you can assign the special propTypes
property:
2、child个数设置
With React.PropTypes.element
you can specify that only a single child can be passed to a component as children.
3、Default Prop Values
参考:https://facebook.github.io/react/docs/typechecking-with-proptypes.html