React
React娇嗔
tzgdd8912442
这个作者很懒,什么都没留下…
展开
-
组件三大组件 refs
1. 字符串的ref (废弃) <script type="text/babel"> //创建组件 class Demo extends React.Component{ showData=()=>{ // 使用react就不要使用document了 const input = document.getElementById('input1');原创 2021-02-19 21:24:49 · 41 阅读 · 0 评论 -
核心属性-props
1. Props进行限制 <Person age = '18' / > {this.props.age+1} = 181 <Person age = {18} /> {this.props.age+1} = 19 可以对标签属性: 进行类型的限制 、 进行默认值处理 // 对标签属性进行类型 必要性的限制 Person.propTypes = { # name:React.PropTypes.string # 15 版本存在 16废弃了 .原创 2021-02-19 19:47:38 · 69 阅读 · 1 评论