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

react知识点汇总

时间:2017-11-18 12:45:48      阅读:233      评论:0      收藏:0      [点我收藏+]

标签:功能   time   ack   instant   lin   bad   man   bsp   trie   

①uncontrolComponent & controlComponent

          If your form is incredibly simple in terms of UI feedback, uncontrolled with refs is entirely fine. You don’t have to listen to what the various articles are saying is “bad.”

featureuncontrolledcontrolled
one-time value retrieval (e.g. on submit) ? ?
validating on submit ? ?
instant field validation ? ?
conditionally disabling submit button ? ?
enforcing input format ? ?
several inputs for one piece of data ? ?
dynamic inputs ? ?

 

    uncontrolComponent

      当不需要验证,或者提交的时候再验证等简单的功能的时候,input应该使用更为简单的  uncontrolComponent 用法的关键点为: ref获取该DOM的值

      <input ref=(ref)=>{this.input = ref} />
      //然后在需用用值的地通过this.input.value获取该值即可

    controlComponent

      需要立即验证,更改输入格式等则使用  controlComponent 

 

react知识点汇总

标签:功能   time   ack   instant   lin   bad   man   bsp   trie   

原文地址:http://www.cnblogs.com/zhilingege/p/7856224.html

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