Answer the question
In order to leave comments, you need to log in
React. Why is ref={()=>{}} faster than ref={this.myGetRef}?
Using ref in this way takes a long time to render the component.
class A extends Component {
constructor(props) {
this.getRef=this.getRef.bind(this);
}
getRef(input) {
this.input = input;
}
render() {
return <TextInput ref={this.getRef}/>
}
}
class A extends Component {
constructor(props) {
}
render() {
return <TextInput ref={(input)=>{this.input = input}}/>
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question