React three usage

React Import, {from} the Component "REACT" 
Export default class MyInput the extends the Component { 
    

    // first 
    getvalue11 = () => { 
        the let HAH = the this .refs.zhi.value 
        the console.log ( "first type" , HAH ) 
    } 
  
    // second type ref using 
   getValue = () => { 
       the console.log ( the this .input1.value) 
   } 
     
    Valuerefs = React.createRef (); // create a container for installing the container that is dedicated ref ref Myrefs can store only one consistent   
    getvalue22 = () => { 
        the let pwd = the this .Valuerefs.current
        console.log("第三种", pwd.value)
    }

    render() {
        return (
            <div>


                {/* 第一种 */}
                <input type="text" ref="zhi"></input>
                <button onClick={this.getvalue11}>按钮</button>    

                {/* 第二种  this.input1的实例是input*/}
                <input type="text" ref={(input)=>{this.input1=input}}></input>
                <button onBlur={this.getvalue}>按钮</button>
* /Third/ *                 

                 {}
                <input type="text" ref={this.Valuerefs}></input>
                <button onClick={this.getvalue22}>按钮</button>


            </div>
        )
    }
}

 

Guess you like

Origin www.cnblogs.com/IwishIcould/p/11619473.html