reactjs - React array of refs -


i have read in post on stackoverflow question refs

that can use following code assign array of refs different inputs this:

<progressbar completed={25} id="progress1" ref={(input) => {this.progress[0] = input }}/>  <progressbar completed={50} id="progress2" ref={(input) => {this.progress[1] = input }}/>  <progressbar completed={75} id="progress3" ref={(input) => {this.progress[2] = input }}/> 

but when try it, returns error:

uncaught typeerror: cannot set property '0' of undefined 

and doesn't work, missing something?

create array in constructor, like:

constructor(){   super()    this.progress = [] } 

Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -