Answer the question
In order to leave comments, you need to log in
Why does _this2.refs.push is not a function error occur in react?
there is a property in the class constructor - this.refs = [] array, why is the context lost?
<div className="listElem">
37 | {n}
38 |
> 39 | <input type="checkbox" ref={ (input) => {this.refs.push(input)}}/>
40 | </div>
41 | )})
42 | }
Answer the question
In order to leave comments, you need to log in
Because it is a built-in object that cannot be overridden, and the object does not have a push method.
Call it something else.)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question