javascript - Dynamically generated input onChange function loses additional argument context -


i trying pass option.title parameter onchange function of corresponding generated radiogroup form component.

onchange receives correct event, option.title value last 1 that's rendered. how bind option.title it's component's onchange? presently, when event triggered, option.title has taken last generated element's value - , shown regardless of element triggered onchange.

generatelist(){         var list = []           (var in configs){             var option = configs[i]             list.push(                 <div>                 <div classname="optiontitle">{option.title}</div>                 <radiogroup onchange={(e) => this.handleradiochange(option.title, e)}  classname="configcontainer" horizontal>                     {this.generateradio(option.options, option.title)}                 </radiogroup>                 </div>             )          }         return list     } 

try this

generatelist(){         return configs.map((option) =>                 (<div>                 <div classname="optiontitle">{option.title}</div>                 <radiogroup onchange={(e) => this.handleradiochange(option.title, e)}  classname="configcontainer" horizontal>                     {this.generateradio(option.options, option.title)}                 </radiogroup>                 </div>             ) )     } 

Comments

Popular posts from this blog

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -

python - Error while using APScheduler: 'NoneType' object has no attribute 'now' -