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

Typechecking With PropTypes

时间:2017-03-23 20:02:22      阅读:135      评论:0      收藏:0      [点我收藏+]

标签:参考   sed   color   ges   github   nbsp   html   img   for   

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 propTypesproperty:

  技术分享

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

Typechecking With PropTypes

标签:参考   sed   color   ges   github   nbsp   html   img   for   

原文地址:http://www.cnblogs.com/tekkaman/p/6606843.html

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